-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setup.py: GCC detection is broken when cross-compiling with a German locale #82653
Comments
However sample output from the compiler is: Es werden eingebaute Spezifikationen verwendet. So the correct matcher would be "gcc-Version", maybe in addition to "gcc version" Due to this the setup fails to build e.g. bzip2 modules as the include and lib paths are passed in via CPATH and LIBRARY_PATH only (module system on HPC system) |
This seems to be a locale issue. So a solution would be to use |
What are you trying to do? Compile Python? Cross-compile Python?
Are you talking about the add_cross_compiling_paths() function which is only called when _PYTHON_HOST_PLATFORM environment variable is set? So GCC says "gcc-Version 9.1.0 (GCC) " with your locale, but does it write "gcc version 9.1.0 ..." with LC_ALL=C? |
Alex, is this still an issue with current python versions (>= 3.9)? And can you followup on Victor's questions? |
Yes this is still an issue. I'm trying to compile Python on an HPC system which uses modules (see e.g. LMod). Yes with LC_ALL=C it does write "gcc version 9.1.0 ..." |
Ok, I reproduced the issue. I wrote PR 30929 to fix it. The issue only occurs when cross-compiling Python with GCC and a German locale. I can reproduce the issue on Fedora 35: $ LC_ALL=de_DE gcc -E -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gcc
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Ziel: x86_64-redhat-linux
Konfiguriert mit: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.2.1-20211203/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread-Modell: posix
Unterst�tzte LTO-Kompressionsalgorithmen: zlib zstd
gcc-Version 11.2.1 20211203 (Red Hat 11.2.1-7) (GCC) The last line starts with "gcc-Version 11.2.1". Whereas the last line starts with "gcc version 11.2.1" with the C locale: $ LC_ALL=C gcc -E -v
Using built-in specs.
COLLECT_GCC=gcc
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.2.1-20211203/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.1 20211203 (Red Hat 11.2.1-7) (GCC) |
FYI distutils.unixccompiler has a private _is_gcc() function: def _is_gcc(self, compiler_name):
# clang uses same syntax for rpath as gcc
return any(name in compiler_name for name in ("gcc", "g++", "clang")) It's called with: compiler = os.path.basename(sysconfig.get_config_var("CC")) For example, on my Fedora 35, compiler is the string: 'gcc -pthread'. So _is_gcc() returns True. |
The workaround for this bug is to build Python using the command: LC_ALL=C make rather than running:
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: