Skip to content

Commit ff11eff

Browse files
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. (cherry picked from commit a9503ac) Co-authored-by: Victor Stinner <[email protected]>
1 parent 49971b2 commit ff11eff

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,9 @@ def add_cross_compiling_paths(self):
682682
tmpfile = os.path.join(self.build_temp, 'ccpaths')
683683
if not os.path.exists(self.build_temp):
684684
os.makedirs(self.build_temp)
685-
ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
685+
# bpo-38472: With a German locale, GCC returns "gcc-Version 9.1.0
686+
# (GCC)", whereas it returns "gcc version 9.1.0" with the C locale.
687+
ret = run_command('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
686688
is_gcc = False
687689
is_clang = False
688690
in_incdirs = False

0 commit comments

Comments
 (0)