Skip to content

Commit 1f036ed

Browse files
authored
bpo-43112: detect musl as a separate SOABI (GH-24502)
musl libc and gnu libc are not ABI compatible so we need set different SOABI for musl and not simply assume that all linux is linux-gnu. Replace linux-gnu with the detected os for the build from config.guess for linux-musl*.
1 parent 24cc641 commit 1f036ed

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

Lib/test/test_sysconfig.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,11 @@ def test_triplet_in_ext_suffix(self):
433433
self.assertTrue('linux' in suffix, suffix)
434434
if re.match('(i[3-6]86|x86_64)$', machine):
435435
if ctypes.sizeof(ctypes.c_char_p()) == 4:
436-
self.assertTrue(suffix.endswith('i386-linux-gnu.so') or
437-
suffix.endswith('x86_64-linux-gnux32.so'),
438-
suffix)
436+
expected_suffixes = 'i386-linux-gnu.so', 'x86_64-linux-gnux32.so', 'i386-linux-musl.so'
439437
else: # 8 byte pointer size
440-
self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix)
438+
expected_suffixes = 'x86_64-linux-gnu.so', 'x86_64-linux-musl.so'
439+
self.assertTrue(suffix.endswith(expected_suffixes),
440+
f'unexpected suffix {suffix!r}')
441441

442442
@unittest.skipUnless(sys.platform == 'darwin', 'OS X-specific test')
443443
def test_osx_ext_suffix(self):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Detect musl libc as a separate SOABI (tagged as ``linux-musl``).

configure

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,11 @@ EOF
981981

982982
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
983983
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
984+
case "$build_os" in
985+
linux-musl*)
986+
PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'`
987+
;;
988+
esac
984989
AC_MSG_RESULT([$PLATFORM_TRIPLET])
985990
else
986991
AC_MSG_RESULT([none])

0 commit comments

Comments
 (0)