The `sysconfig.get_platform()` function raises a `ValueError` if the `cflags` config value (e.g. the `CFLAGS` used at build time) includes the text `-arch` where that doesn't refer to the compiler flag of the same name.
Consider the following example build:
$ sw_vers
ProductName: macOS
ProductVersion: 11.6.3
BuildVersion: 20G415
$ curl -LO https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tar.xz
$ tar -xf Python-3.10.2.tar.xz
$ cd Python-3.10.2
$ export CFLAGS="-Itest-arch/fake" # just something that includes -arch
$ ./configure --prefix=$(pwd)/test-arch
$ make -j
Here the build fails with the following error:
./python.exe -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Traceback (most recent call last):
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/sysconfig.py", line 803, in <module>
_main()
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/sysconfig.py", line 791, in _main
_generate_posix_vars()
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/sysconfig.py", line 457, in _generate_posix_vars
pybuilddir = f'build/lib.{get_platform()}-{_PY_VERSION_SHORT}'
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/sysconfig.py", line 744, in get_platform
osname, release, machine = _osx_support.get_platform_osx(
File "/Users/duncanmacleod/src/Python-3.10.2/Lib/_osx_support.py", line 556, in get_platform_osx
raise ValueError(
ValueError: Don't know machine value for archs=()
generate-posix-vars failed
Sorry if this is a duplicate of an existing issue.
|