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*.
This commit is contained in:
Natanael Copa 2022-01-29 00:02:54 +01:00 committed by GitHub
parent 24cc6411ad
commit 1f036ede59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -433,11 +433,11 @@ class TestSysConfig(unittest.TestCase):
self.assertTrue('linux' in suffix, suffix) self.assertTrue('linux' in suffix, suffix)
if re.match('(i[3-6]86|x86_64)$', machine): if re.match('(i[3-6]86|x86_64)$', machine):
if ctypes.sizeof(ctypes.c_char_p()) == 4: if ctypes.sizeof(ctypes.c_char_p()) == 4:
self.assertTrue(suffix.endswith('i386-linux-gnu.so') or expected_suffixes = 'i386-linux-gnu.so', 'x86_64-linux-gnux32.so', 'i386-linux-musl.so'
suffix.endswith('x86_64-linux-gnux32.so'),
suffix)
else: # 8 byte pointer size 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') @unittest.skipUnless(sys.platform == 'darwin', 'OS X-specific test')
def test_osx_ext_suffix(self): def test_osx_ext_suffix(self):

View File

@ -0,0 +1 @@
Detect musl libc as a separate SOABI (tagged as ``linux-musl``).

5
configure generated vendored
View File

@ -6090,6 +6090,11 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` 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 "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5
$as_echo "$PLATFORM_TRIPLET" >&6; } $as_echo "$PLATFORM_TRIPLET" >&6; }
else else

View File

@ -981,6 +981,11 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` 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]) AC_MSG_RESULT([$PLATFORM_TRIPLET])
else else
AC_MSG_RESULT([none]) AC_MSG_RESULT([none])