[Python-checkins] bpo-36508: python-config don't export LINKFORSHARED (GH-12661)

Victor Stinner webhook-mailer at python.org
Tue Apr 9 12:12:49 EDT 2019


https://github.com/python/cpython/commit/e65f01f78d7bda3013fc5be485afa87ff56511d9
commit: e65f01f78d7bda3013fc5be485afa87ff56511d9
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-04-09T18:12:44+02:00
summary:

bpo-36508: python-config don't export LINKFORSHARED (GH-12661)

python-config --ldflags no longer includes flags of the LINKFORSHARED
variable. The LINKFORSHARED variable must only be used to build
executables.

files:
A Misc/NEWS.d/next/Build/2019-04-02-17-01-23.bpo-36508.SN5Y6N.rst
M Makefile.pre.in
M Misc/python-config.in
M Misc/python-config.sh.in

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 174b12c5de8b..1cb8a590d45b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -104,6 +104,8 @@ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
 NO_AS_NEEDED=	@NO_AS_NEEDED@
 SGI_ABI=	@SGI_ABI@
 CCSHARED=	@CCSHARED@
+# LINKFORSHARED are the flags passed to the $(CC) command that links
+# the python executable -- this is only needed for a few systems
 LINKFORSHARED=	@LINKFORSHARED@
 ARFLAGS=	@ARFLAGS@
 # Extra C flags added for building the interpreter object files.
diff --git a/Misc/NEWS.d/next/Build/2019-04-02-17-01-23.bpo-36508.SN5Y6N.rst b/Misc/NEWS.d/next/Build/2019-04-02-17-01-23.bpo-36508.SN5Y6N.rst
new file mode 100644
index 000000000000..62f80840a044
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2019-04-02-17-01-23.bpo-36508.SN5Y6N.rst
@@ -0,0 +1,3 @@
+``python-config --ldflags`` no longer includes flags of the
+``LINKFORSHARED`` variable. The ``LINKFORSHARED`` variable must only be used
+to build executables.
diff --git a/Misc/python-config.in b/Misc/python-config.in
index e13da7543c9f..714415222798 100644
--- a/Misc/python-config.in
+++ b/Misc/python-config.in
@@ -55,8 +55,6 @@ for opt in opt_flags:
         if opt == '--ldflags':
             if not getvar('Py_ENABLE_SHARED'):
                 libs.insert(0, '-L' + getvar('LIBPL'))
-            if not getvar('PYTHONFRAMEWORK'):
-                libs.extend(getvar('LINKFORSHARED').split())
         print(' '.join(libs))
 
     elif opt == '--extension-suffix':
diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
index d1d3275fa275..a3c479ce571f 100644
--- a/Misc/python-config.sh.in
+++ b/Misc/python-config.sh.in
@@ -44,7 +44,6 @@ ABIFLAGS="@ABIFLAGS@"
 LIBS="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS"
 BASECFLAGS="@BASECFLAGS@"
 LDLIBRARY="@LDLIBRARY@"
-LINKFORSHARED="@LINKFORSHARED@"
 OPT="@OPT@"
 PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
 LDVERSION="@LDVERSION@"
@@ -89,15 +88,11 @@ do
             echo "$LIBS"
         ;;
         --ldflags)
-            LINKFORSHAREDUSED=
-            if [ -z "$PYTHONFRAMEWORK" ] ; then
-                LINKFORSHAREDUSED=$LINKFORSHARED
-            fi
             LIBPLUSED=
             if [ "$PY_ENABLE_SHARED" = "0" ] ; then
                 LIBPLUSED="-L$LIBPL"
             fi
-            echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED"
+            echo "$LIBPLUSED -L$libdir $LIBS"
         ;;
         --extension-suffix)
             echo "$SO"



More information about the Python-checkins mailing list