Skip to content

Commit a9503ac

Browse files
authored
bpo-38472: setup.py uses LC_ALL=C to check the C compiler (GH-30929)
Fix GCC detection in setup.py when cross-compiling. The C compiler is now run with LC_ALL=C. Previously, the detection failed with a German locale.
1 parent 8548366 commit a9503ac

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix GCC detection in setup.py when cross-compiling. The C compiler is now
2+
run with LC_ALL=C. Previously, the detection failed with a German locale.

setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,9 @@ def add_cross_compiling_paths(self):
848848
tmpfile = os.path.join(self.build_temp, 'ccpaths')
849849
if not os.path.exists(self.build_temp):
850850
os.makedirs(self.build_temp)
851-
ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
851+
# bpo-38472: With a German locale, GCC returns "gcc-Version 9.1.0
852+
# (GCC)", whereas it returns "gcc version 9.1.0" with the C locale.
853+
ret = run_command('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
852854
is_gcc = False
853855
is_clang = False
854856
in_incdirs = False

0 commit comments

Comments
 (0)