From 480c0f118613dde8fd28eca1b959469903986ae0 Mon Sep 17 00:00:00 2001 From: Yaksh Bariya Date: Sat, 7 Mar 2026 01:49:19 +0530 Subject: [PATCH 1/2] GH-138800: fix variable substitution in python3.pc for Android Essentially a revert of the part where LIBPYTHON is made to use BLDLIBRARY in 7f5e3f04f838686d65f1053a5e47f5d3faf0b228. We can't use BLDLIBRARY as it adds `-L.`, which is not expected behaviour. Part of downstream distribution of Termux porting Python 3.13 to Termux (Android). This is the revised version after proper review and fixes --- .../next/Build/2026-03-07-02-09-57.gh-issue-138800.VD8qbz.rst | 1 + configure | 2 +- configure.ac | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-03-07-02-09-57.gh-issue-138800.VD8qbz.rst diff --git a/Misc/NEWS.d/next/Build/2026-03-07-02-09-57.gh-issue-138800.VD8qbz.rst b/Misc/NEWS.d/next/Build/2026-03-07-02-09-57.gh-issue-138800.VD8qbz.rst new file mode 100644 index 00000000000000..b04da2e2c6852f --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-03-07-02-09-57.gh-issue-138800.VD8qbz.rst @@ -0,0 +1 @@ +fix LIBPYTHON substitution in python3.pc on Android diff --git a/configure b/configure index eca5f03cdcfb2d..0fac5a47f460c8 100755 --- a/configure +++ b/configure @@ -27085,7 +27085,7 @@ LIBPYTHON='' # On Android and Cygwin the shared libraries must be linked with libpython. if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(LDLIBRARY)" - LIBPYTHON="\$(BLDLIBRARY)" + LIBPYTHON="-lpython${VERSION}${ABIFLAGS}" fi # On iOS the shared libraries must be linked with the Python framework diff --git a/configure.ac b/configure.ac index c21024a1e77433..8e7c741f3d37ce 100644 --- a/configure.ac +++ b/configure.ac @@ -6488,7 +6488,7 @@ LIBPYTHON='' # On Android and Cygwin the shared libraries must be linked with libpython. if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(LDLIBRARY)" - LIBPYTHON="\$(BLDLIBRARY)" + LIBPYTHON="-lpython${VERSION}${ABIFLAGS}" fi # On iOS the shared libraries must be linked with the Python framework From 43e0d0445068f1fc2eca4a76eb1f8dbb823b695d Mon Sep 17 00:00:00 2001 From: Yaksh Bariya Date: Sat, 7 Mar 2026 02:24:49 +0530 Subject: [PATCH 2/2] fix: use BLDLIBRARY instead of LIBPYTHON whne building libraries patch based off of https://github.com/msys2-contrib/cpython-mingw/commit/e719663e07d6655e042f9c48910c65606cc4ae5e --- Modules/makesetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/makesetup b/Modules/makesetup index 104c824b846540..4d0ef59edeca83 100755 --- a/Modules/makesetup +++ b/Modules/makesetup @@ -277,7 +277,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | ;; esac rule="$file: $objs \$(MODULE_${mods_upper}_LDEPS)" - rule="$rule; \$(BLDSHARED) $objs $libs \$(LIBPYTHON) -o $file" + rule="$rule; \$(BLDSHARED) $objs $libs \$(BLDLIBRARY) -o $file" echo "$rule" >>$rulesf done done