Skip to content

Commit 90be969

Browse files
miss-islingtonthunder-codingambvmhsmith
authored
[3.14] GH-138800: Fix variable substitution in python3.pc for Android (GH-144776) (#155108)
Clarifies the difference between LIBPYTHON, which is the library name, and the flags needed to build modules, which also need the linking path. (cherry picked from commit 5918085) Co-authored-by: Yaksh Bariya <yakshbari4@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Malcolm Smith <smith@chaquo.com>
1 parent b0ef8b4 commit 90be969

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ DIST= $(DISTFILES) $(DISTDIRS)
280280
LIBRARY= @LIBRARY@
281281
LDLIBRARY= @LDLIBRARY@
282282
BLDLIBRARY= @BLDLIBRARY@
283+
MODULE_LDFLAGS_SHARED=$(if $(LIBPYTHON),$(BLDLIBRARY))
283284
PY3LIBRARY= @PY3LIBRARY@
284285
DLLLIBRARY= @DLLLIBRARY@
285286
LDLIBRARYDIR= @LDLIBRARYDIR@
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix library name in python3.pc on Android.

Modules/makesetup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
276276
;;
277277
esac
278278
rule="$file: $objs \$(MODULE_${mods_upper}_LDEPS)"
279-
rule="$rule; \$(BLDSHARED) $objs $libs \$(LIBPYTHON) -o $file"
279+
rule="$rule; \$(BLDSHARED) $objs $libs \$(MODULE_LDFLAGS_SHARED) -o $file"
280280
echo "$rule" >>$rulesf
281281
done
282282
done

configure

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6448,18 +6448,21 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
64486448
AC_MSG_RESULT([$LDVERSION])
64496449

64506450
# Configure the flags and dependencies used when compiling shared modules.
6451-
# Do not rename LIBPYTHON - it's accessed via sysconfig by package build
6452-
# systems (e.g. Meson) to decide whether to link extension modules against
6453-
# libpython.
64546451
AC_SUBST([MODULE_DEPS_SHARED])
64556452
AC_SUBST([LIBPYTHON])
64566453
MODULE_DEPS_SHARED='$(MODULE_DEPS_STATIC) $(EXPORTSYMS)'
6454+
6455+
# On most platforms, extension modules aren't linked against libpython, so
6456+
# LIBPYTHON must be empty.
64576457
LIBPYTHON=''
64586458

64596459
# On Android and Cygwin the shared libraries must be linked with libpython.
6460+
# LIBPYTHON is used by python-config, python3.pc, the commands for building the
6461+
# stdlib's own extension modules, and external package build systems via
6462+
# sysconfig, so its value must be suitable for all those contexts.
64606463
if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then
64616464
MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(LDLIBRARY)"
6462-
LIBPYTHON="\$(BLDLIBRARY)"
6465+
LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"
64636466
fi
64646467

64656468
# On iOS the shared libraries must be linked with the Python framework

0 commit comments

Comments
 (0)