From 3f79de7b8411c76a1fcd1ca850ea62500be7a881 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Sat, 29 Jan 2022 00:02:54 +0100 Subject: [PATCH 1/2] bpo-43112: detect musl as a separate SOABI (GH-24502) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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*. (cherry picked from commit 1f036ede59e2c4befc07714cf76603c591d5c972) Signed-off-by: Šimon Bořek --- Lib/test/test_sysconfig.py | 8 ++++---- .../next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst | 1 + configure | 5 +++++ configure.ac | 5 +++++ 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -425,11 +425,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): --- /dev/null +++ b/Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst @@ -0,0 +1 @@ +Detect musl libc as a separate SOABI (tagged as ``linux-musl``). \ No newline at end of file --- a/configure +++ b/configure @@ -5376,6 +5376,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 --- a/configure.ac +++ b/configure.ac @@ -866,6 +866,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])