diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 23828898d3..6ad95e757e 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -39,6 +39,9 @@ const char *_PyImport_DynLoadFiletab[] = { ".dll", #else /* !__CYGWIN__ */ "." SOABI ".so", +#ifdef GNU_FALLBACK_SOABI + "." GNU_FALLBACK_SOABI ".so", +#endif #ifdef ALT_SOABI "." ALT_SOABI ".so", #endif diff --git a/configure.ac b/configure.ac index 0e6b617080..72700cba84 100644 --- a/configure.ac +++ b/configure.ac @@ -4781,6 +4781,14 @@ AC_MSG_CHECKING(SOABI) SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} AC_MSG_RESULT($SOABI) +# musl libc fallback to read -gnu SOABI for backwards compat +if test "$SOABI" != "${SOABI%-musl}"; then + AC_SUBST(GNU_FALLBACK_SOABI) + GNU_FALLBACK_SOABI="${SOABI%-musl}-gnu" + AC_DEFINE_UNQUOTED(GNU_FALLBACK_SOABI, "${GNU_FALLBACK_SOABI}", + [Compatibility to read C extentions with -gnu suffix on musl libc]) +fi + # Release and debug (Py_DEBUG) ABI are compatible, but not Py_TRACE_REFS ABI if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then # Similar to SOABI but remove "d" flag from ABIFLAGS