Olly Betts <olly <at> survex.com> writes: > > On 2007-06-19, Peter O'Gorman <peter <at> pogma.com> wrote: > > I am inclined to vote for (1) for now. It might be worth a figuring out > > how to have ldconfig (or some other utility) output the real search path > > that the dynamic linker uses for the future, parsing ld.so.conf and > > friends seems to be fragile, this is not the first time that it has had > > problems. > > That reminded me that I have this patch lying around, which I'd been > meaning to put forward. > > The motivation behind this was that libtool currently doesn't know about > systems where ldconfig has extra default trusted directories (such as > /usr/lib64) so libtool sets an rpath for libraries installed in these > directories, which is against the policies of most Linux distros, and > fixing this currently requires hackery in packaging scripts. But it > nicely solves this issue too. > > Patch is against the 1.5 branch, because that's where I was trying > this out, but if you think this approach is suitable for inclusion, I'm > happy to update it for HEAD and try to provide a suitable ChangeLog > entry. > > Index: libtool.m4 > =================================================================== > RCS file: /sources/libtool/libtool/Attic/libtool.m4,v > retrieving revision 1.314.2.181 > diff -p -u -r1.314.2.181 libtool.m4 > --- libtool.m4 18 Jun 2007 02:07:45 -0000 1.314.2.181 > +++ libtool.m4 23 Jun 2007 14:37:02 -0000 > <at> <at> -1618,10 +1618,10 <at> <at> linux* | k*bsd*-gnu) > # before this can be enabled. > hardcode_into_libs=yes > > - # Append ld.so.conf contents to the search path > - if test -f /etc/ld.so.conf; then > - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if > (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= > ]* / /g;/^$/d' | tr '\n' ' '` > - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" > + # Extract search path from ldconfig > + ldconfig_search_path=`/sbin/ldconfig -N -X -v 2>/dev/null|sed 's,^\(/.*\):\( (.*)\)\?$,\1,p;d'` > + if test -n "$ldconfig_search_path"; then > + sys_lib_dlsearch_path_spec=$ldconfig_search_path > fi > > # We used to test for /lib/ld.so.1 and disable shared libraries on
On my system I have to replace the line feeds in the output of /sbin/ldconfig by spaces, otherwise I end up with the following in config.status: sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib /lib/i686 /usr/lib/i486 /usr/lib/i586 /usr/lib/i686 /usr/lib/sse2 /lib/i686/cmov /usr/lib/i686/cmov' This will trigger a 'missing separator' error during make. Here the original patch plus the line feed replacement applied to the current HEAD: diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 4bc6b22..86a7ba6 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -2743,10 +2743,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; ski - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + # Extract search path from ldconfig, see https://lists.gnu.org/archive/html/libtool-patches/2010-06/msg00145.html + ldconfig_search_path=`/sbin/ldconfig -N -X -v 2>/dev/null|sed 's,^\(/.*\):\( (.*)\)\?$,\1,p;d' | tr '\n' ' '` + if test -n "$ldconfig_search_path"; then + sys_lib_dlsearch_path_spec=$ldconfig_search_path fi # We used to test for /lib/ld.so.1 and disable shared libraries on Christian > Cheers, > Olly > > _______________________________________________ > http://lists.gnu.org/mailman/listinfo/libtool > > _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool