bjia56 / portable-python-cmake-buildsystem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'sys' has no attribute 'abiflags' when building Python 3.12.2

dbrnz opened this issue · comments

Thanks for your efforts!

Using the current HEAD to build Python 3.12.2, under both macOS and Ubuntu 20, results in the following:

[479/479] Relocate _sysconfigdata__linux2_.py and update pybuilddir.txt
FAILED: bin/pybuilddir.txt lib/python3.12/lib-dynload/_sysconfigdata__linux2_.py /home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/bin/pybuilddir.txt /home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/lib/python3.12/lib-dynload/_sysconfigdata__linux2_.py
cd /home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/bin && env LD_LIBRARY_PATH=/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/lib /home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/bin/python -E -S -m sysconfig --generate-posix-vars && /usr/bin/cmake -DBIN_BUILD_DIR:PATH=/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/bin -DSYSCONFIGDATA_PY:STRING=_sysconfigdata__linux2_.py -DPYTHON_BINARY_DIR:PATH=/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build -DEXTENSION_INSTALL_DIR:PATH=lib/python3.12/lib-dynload -P /home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild/cmake/UpdateSysconfig.cmake
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/lib/python3.12/sysconfig.py", line 876, in <module>
    _main()
  File "/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/lib/python3.12/sysconfig.py", line 864, in _main
    _generate_posix_vars()
  File "/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/lib/python3.12/sysconfig.py", line 509, in _generate_posix_vars
    name = _get_sysconfigdata_name()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/build/opencor/build/src/plugins/thirdParty/Python/PythonBuild-prefix/src/PythonBuild-build/lib/python3.12/sysconfig.py", line 465, in _get_sysconfigdata_name
    f'_sysconfigdata_{sys.abiflags}_{sys.platform}_{multiarch}',
                      ^^^^^^^^^^^^
AttributeError: module 'sys' has no attribute 'abiflags'

Hi @dbrnz! Is there a place for me to see how you're calling into the buildsystem from opencor?

That was quick -- I see you already have a PR!

Our relevant CMake code is here but now tweaked to specify Python 3.12.2 from your branch. Simplest though would for me to reference your PR and re-build.

I would recommend keeping PYTHON_APPLY_PATCHES enabled - the core patches for 3.11 and 3.12 were needed to get things compiled correctly. Patches specific to the portable Python project have recently been put behind a flag, disabled by default.

Well, with PR #11 merged, but without PYTHON_APPLY_PATCHES, I have a working Python 3.12! Thanks!!

Great! I'll merge that in