From 82bf05d215dfcc2ef779395bf79b5fc23d5b9555 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 10 Feb 2021 18:36:04 +0100 Subject: [PATCH 1/4] bpo-43112: detect musl as a separate SOABI 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*. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 0ca5c93..ddde153 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -378,10 +378,13 @@ class TestSysConfig(unittest.TestCase): if re.match('(i[3-6]86|x86_64)$', machine): if ctypes.sizeof(ctypes.c_char_p()) == 4: self.assertTrue(suffix.endswith('i386-linux-gnu.so') or - suffix.endswith('x86_64-linux-gnux32.so'), + suffix.endswith('x86_64-linux-gnux32.so') or + suffix.endswith('i386-linux-musl.so'), suffix) else: # 8 byte pointer size - self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix) + self.assertTrue(suffix.endswith('x86_64-linux-gnu.so') or + suffix.endswith('x86_64-linux-musl.so'), + suffix) @unittest.skipUnless(sys.platform == 'darwin', 'OS X-specific test') def test_osx_ext_suffix(self): diff --git a/configure b/configure index b7be60e..d9801f4 100755 --- a/configure +++ b/configure @@ -5358,6 +5358,11 @@ EOF if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` + case "$build_os" in + linux-musl*) + PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` + ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5 $as_echo "$PLATFORM_TRIPLET" >&6; } else diff --git a/configure.ac b/configure.ac index 6a1b066..d732257 100644 --- a/configure.ac +++ b/configure.ac @@ -876,6 +876,11 @@ EOF if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` + case "$build_os" in + linux-musl*) + PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` + ;; + esac AC_MSG_RESULT([$PLATFORM_TRIPLET]) else AC_MSG_RESULT([none])