Skip to content

Commit df26596

Browse files
mhsmiththunder-codingambv
authored
[3.13] GH-138800: Fix variable substitution in python3.pc for Android (GH-144776) (#155111)
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>
1 parent eaa9bac commit df26596

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
@@ -270,6 +270,7 @@ DIST= $(DISTFILES) $(DISTDIRS)
270270
LIBRARY= @LIBRARY@
271271
LDLIBRARY= @LDLIBRARY@
272272
BLDLIBRARY= @BLDLIBRARY@
273+
MODULE_LDFLAGS_SHARED=$(if $(LIBPYTHON),$(BLDLIBRARY))
273274
PY3LIBRARY= @PY3LIBRARY@
274275
DLLLIBRARY= @DLLLIBRARY@
275276
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
@@ -274,7 +274,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
274274
;;
275275
esac
276276
rule="$file: $objs"
277-
rule="$rule; \$(BLDSHARED) $objs $libs \$(LIBPYTHON) -o $file"
277+
rule="$rule; \$(BLDSHARED) $objs $libs \$(MODULE_LDFLAGS_SHARED) -o $file"
278278
echo "$rule" >>$rulesf
279279
done
280280
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
@@ -6335,18 +6335,21 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
63356335
AC_MSG_RESULT([$LDVERSION])
63366336

63376337
# Configure the flags and dependencies used when compiling shared modules.
6338-
# Do not rename LIBPYTHON - it's accessed via sysconfig by package build
6339-
# systems (e.g. Meson) to decide whether to link extension modules against
6340-
# libpython.
63416338
AC_SUBST([MODULE_DEPS_SHARED])
63426339
AC_SUBST([LIBPYTHON])
63436340
MODULE_DEPS_SHARED='$(MODULE_DEPS_STATIC) $(EXPORTSYMS)'
6341+
6342+
# On most platforms, extension modules aren't linked against libpython, so
6343+
# LIBPYTHON must be empty.
63446344
LIBPYTHON=''
63456345

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

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

0 commit comments

Comments
 (0)