]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43112: detect musl as a separate SOABI (GH-24502)
authorNatanael Copa <ncopa@alpinelinux.org>
Fri, 28 Jan 2022 23:02:54 +0000 (00:02 +0100)
committerGitHub <noreply@github.com>
Fri, 28 Jan 2022 23:02:54 +0000 (15:02 -0800)
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*.

Lib/test/test_sysconfig.py
Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst [new file with mode: 0644]
configure
configure.ac

index 80fe9c8a8b1e0eada24214ac9f8a5fb8903fd0c4..7ba004d77315d0957a1b45a31eb90e89586dd386 100644 (file)
@@ -433,11 +433,11 @@ class TestSysConfig(unittest.TestCase):
             self.assertTrue('linux' in suffix, suffix)
         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)
+                expected_suffixes = 'i386-linux-gnu.so', 'x86_64-linux-gnux32.so', 'i386-linux-musl.so'
             else: # 8 byte pointer size
-                self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix)
+                expected_suffixes = 'x86_64-linux-gnu.so', 'x86_64-linux-musl.so'
+        self.assertTrue(suffix.endswith(expected_suffixes),
+                        f'unexpected suffix {suffix!r}')
 
     @unittest.skipUnless(sys.platform == 'darwin', 'OS X-specific test')
     def test_osx_ext_suffix(self):
diff --git a/Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst b/Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst
new file mode 100644 (file)
index 0000000..0e250ed
--- /dev/null
@@ -0,0 +1 @@
+Detect musl libc as a separate SOABI (tagged as ``linux-musl``).
\ No newline at end of file
index 22c65e492fbab2385e9761b85aa4c8624262768b..da4af32cc17aaff386708a37a28c375cb7802440 100755 (executable)
--- a/configure
+++ b/configure
@@ -6090,6 +6090,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
index 9bc6e3beecbcc1f822b4d65a06d558bd62167518..5a076646b96dd7964e547dfe9de21a8244d4d35a 100644 (file)
@@ -981,6 +981,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])