pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lang/python27: (patch) RPATH breaking build with previous installed python27



On Mon, Feb 17, 2014 at 11:33:39AM -0500, Greg Troxel wrote:
> 
> Matthias Ferdinand <mf+ml.pkgsrc-users%netzwerkagentursaarland.de@localhost>
> writes:
> 
> > Should be possible to add the --enable-new-dtags option only for glibc
> > systems. Cannot say if fixing the RPATH/LD_LIBRARY_PATH issue will
> > remain the only side effect of that flag. Might break someone elses
> > installation that relied on LD_LIBRARY_PATH being ignored by pkgsrc
> > packages. Might as well have more subtle failure cases while packages
> > using RUNPATH are mixed with ones using RPATH.
> 
> It might be good to have generalized support in pkgsrc for working
> around the issue by using RUNPATH for whatever combinations of
> compiler/libc have this bug.  That sounds better to me than munging a
> specific package, in terms of solving the right issue.

Here is a patch for pkgsrc/mk/compiler/gcc.mk. It adds the
'--enable-new-dtags' linker option on Linux installations.

This modification allows me to build python27 while an older python27 is
already installed.

With '--enable-new-dtags' the linker adds _both_ RPATH and RUNPATH
entries to the binary, and LD_LIBRARY_PATH is then usable again as an
override mechanism.

I found this to work on all my Linux pkgsrc build hosts:
        SuSE 9.0 / 9.2 / 10.0 (i386)  (*)
        Ubuntu 6.06 (i386)
        Ubuntu 8.04 / 10.04 (i386)
        Ubuntu 10.04 / 12.04 (x64)
        Debian Testing (i386)

(*): RPATH does not yet have precedence over LD_LIBRARY_PATH

Probably the patch will also work on recent Redhat / Fedora / SuSE
distributions. Can someone on the list test and let us know?

The other makefiles under pkgsrc/mk/compiler/ can easily be modified
accordingly. But I can't test them, as I only ever used gcc - while I
have compiled clang once, I could not figure out how to use it for
pkgsrc.

Matthias
--- pkgsrc/mk/compiler/gcc.mk.orig      2014-02-07 05:37:20.000000000 +0100
+++ pkgsrc/mk/compiler/gcc.mk   2014-02-17 21:49:24.000000000 +0100
@@ -588,8 +588,15 @@
 # GNU ld option used to set the rpath
 _LINKER_RPATH_FLAG=    -R
 
+.if ${OPSYS} == "Linux"
+# mf 20140217: make ld provide DT_RUNPATH entries in addition to DT_RPATH,
+#              in order to make LD_LIBRARY_PATH gain precedence
+#              
(http://mail-index.netbsd.org/pkgsrc-users/2014/02/16/msg019321.html)
+_LINKER_RPATH_FLAG=    --enable-new-dtags -R
+.endif
+
 # GCC passes rpath directives to the linker using "-Wl,-R".
-_COMPILER_RPATH_FLAG=  -Wl,${_LINKER_RPATH_FLAG}
+_COMPILER_RPATH_FLAG=  -Wl,${_LINKER_RPATH_FLAG:Q:C/([\\] )([\\] )*/,/g}
 
 .if !empty(MACHINE_ARCH:Mmips*)
 _COMPILER_ABI_FLAG.32= -mabi=n32       # ABI == "32" == "n32"


Home | Main Index | Thread Index | Old Index