Skip to content

Commit 171fdf2

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 a57ec7a commit 171fdf2

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
@@ -757,7 +757,9 @@ def add_cross_compiling_paths(self):
757757
tmpfile = os.path.join(self.build_temp, 'ccpaths')
758758
if not os.path.exists(self.build_temp):
759759
os.makedirs(self.build_temp)
760-
ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
760+
# bpo-38472: With a German locale, GCC returns "gcc-Version 9.1.0
761+
# (GCC)", whereas it returns "gcc version 9.1.0" with the C locale.
762+
ret = run_command('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
761763
is_gcc = False
762764
is_clang = False
763765
in_incdirs = False

0 commit comments

Comments
 (0)