From 6ad1b1f09f10f406e90ea8471fe5f3ff1942448b Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 24 Nov 2021 21:18:39 +0100 Subject: main/python3: add fallback for -gnu soabi In commit b89cfd222ae3 (main/python3: use musl SOABI) a patch was introduced to make it easier to detect a musl built python and with the intention to make it easier to build python wheels without clashing with musl binaries. It was a wrong assumption that pip acutally care about the SOABI. Meanwhile upstream python has been working on adding support for musl binaries (pep 656), which does not rely on SOABI. This has resulted in breakage with alpine built python which no longer loads binaries with -gnu.so suffix. As a workaround we add a patch to also look for shared libraries with -gnu.so suffix in addition to -musl.so. ref https://gitlab.alpinelinux.org/alpine/aports/-/issues/13227 --- main/python3/APKBUILD | 4 +++- main/python3/gnu-fallback-soabi.patch | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 main/python3/gnu-fallback-soabi.patch diff --git a/main/python3/APKBUILD b/main/python3/APKBUILD index 318332ba1c..5d55ebab4d 100644 --- a/main/python3/APKBUILD +++ b/main/python3/APKBUILD @@ -6,7 +6,7 @@ pkgname=python3 pkgver=3.9.7 _bluez_ver=5.55 _basever="${pkgver%.*}" -pkgrel=3 +pkgrel=4 pkgdesc="A high-level scripting language" url="https://www.python.org/" arch="all" @@ -23,6 +23,7 @@ source="https://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz arm-alignment.patch mpdecimal-2.5.1.patch bpo-43112.patch + gnu-fallback-soabi.patch " options="net" # Required for tests builddir="$srcdir/Python-$pkgver" @@ -206,4 +207,5 @@ ab8eaa2858d5109049b1f9f553198d40e0ef8d78211ad6455f7b491af525bffb16738fed60fc84e9 a84483246e413650a904c34c18f5e4f4168c39067d069f48557c330de6eb3db19fd96a4d453d742db3dcb7c7f962722903f62823c752ff90510c89830435ffc0 arm-alignment.patch d95e36ef3c315a2ddf689c9319e027cf56e8817b0cae139e3ade4742ab6f9efcb3cc4adca178e9bbc8757bd0e3fb924ac2b37e66e70eaa7288202a25339eed7d mpdecimal-2.5.1.patch 68a3b0bc270e4f7ec8593945c8c891fab988489f4ba9ee78a0e4351df0699db16dfad7d374f13758c80962b0cea048ff577c0462857cd13919d6cefa1f6a382f bpo-43112.patch +7500d4e51975446fd59231985f75a198e8074b9f0a0941b7998958e8a4175de09bd08fd1b4db26aa82f9cef0db922078bf4a6f05e50abc37a200c5f6169e6868 gnu-fallback-soabi.patch " diff --git a/main/python3/gnu-fallback-soabi.patch b/main/python3/gnu-fallback-soabi.patch new file mode 100644 index 0000000000..cc366c5ca2 --- /dev/null +++ b/main/python3/gnu-fallback-soabi.patch @@ -0,0 +1,33 @@ +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 -- cgit v1.2.3