tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH v2] Fixing the subtle python PLIST breakage on installing with an older version present
Am Thu, 4 Apr 2019 22:26:35 +0200
schrieb Leonardo Taccari <leot%NetBSD.org@localhost>:
> SUBST_FILES.usebuildlib= configure
> SUBST_SED.usebuildlib= -e '/RUNSHARED=LD_LIBRARY_PATH=/s,$, LD_PRELOAD=`pwd`/"$LDLIBRARY".$SOVERSION,'
> In that way all @RUNSHARED@ occurencies will be adjusted (unfortunately
> we could not reuse $(INSTSONAME) because it's defined later).
Well, it's already all occurences that matter for Linux. Besides
Makefile.pre.in, I only see these:
./Mac/PythonLauncher/Makefile.in:RUNSHARED= @RUNSHARED@
./Mac/PythonLauncher/Makefile.in: sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
./Mac/Makefile.in:RUNSHARED=@RUNSHARED@
./Mac/Makefile.in: -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
./Mac/Makefile.in: sed "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`!g" < "$(srcdir)/IDLE/IDLE.app/Contents/Info.plist" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/Info.plis
t"
./Mac/Makefile.in: $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \
I suppose Mac is of no concern here.
So it is a matter of preference. In a patch to push upstream, the best
place probably is indeed configure[.ac]. There is this block (python37),
which is identical in both configure and configure.ac:
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
then
PY3LIBRARY=libpython3.so
fi
;;
I guess it needs changing to
GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
then
PY3LIBRARY=libpython3.so
fi
;;
Linux*)
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED="LD_PRELOAD=`pwd`/$LDLIBRARY.$SOVERSION${LD_PRELOAD:+:${LD_PRELOAD}} LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
then
PY3LIBRARY=libpython3.so
fi
;;
(Not sure about GNU … is this about GNU/kfreebsd? What linker semantics
does that have?)
I'd keep the LD_LIBRARY_PATH setting there, although it may be
redundant. I am attaching a new diff with the sed-hacking adjusted to
Leonardo's suggestion. I tested it with python37.
Alrighty then,
Thomas
--
Dr. Thomas Orgis
HPC @ Universität Hamburg
--- Makefile.nisfix 2019-04-04 18:45:09.224356457 +0200
+++ Makefile 2019-04-05 10:35:09.249273704 +0200
@@ -160,6 +160,18 @@
SUBST_SED.findlib= -e 's,/usr/local,${PREFIX},'
SUBST_SED.findlib+= -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!"
+# ELF's RPATH overrides LD_LIBRARY_PATH, resulting in the installed
+# libpython from an earlier minor version being found, messing up
+# PLIST with a wrong version string.
+.if ${OPSYS} == "Linux"
+SUBST_CLASSES+= usebuildlib
+SUBST_MESSAGE.usebuildlib= Preventing use of installed libpython.
+SUBST_STAGE.usebuildlib= pre-configure
+SUBST_FILES.usebuildlib= configure
+SUBST_SED.usebuildlib= -e 's,RUNSHARED=\(LD_LIBRARY_PATH=.*\)$$,RUNSHARED="LD_PRELOAD=`pwd`/$$LDLIBRARY.$$SOVERSION$${LD_PRELOAD:+:$${LD_PRELOAD}} \1",'
+.endif
+
+
.include "options.mk"
CHECK_INTERPRETER_SKIP= lib/python${PY_VER_SUFFIX}/venv/scripts/posix/pydoc
Home |
Main Index |
Thread Index |
Old Index