[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Use ldconfig to generate sys_lib_dlsearch_path_spec
From: |
Orion Poplawski |
Subject: |
Re: [PATCH] Use ldconfig to generate sys_lib_dlsearch_path_spec |
Date: |
Wed, 5 Mar 2014 18:13:52 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Christian Rössel <christian.roessel <at> gmx.de> writes:
>
> 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
> <at> <at> -2743,10 +2743,10 <at> <at> 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
After almost 7 years, it would be really nice to get this fixed. Does this
help?
>From 9576fe6d88eb2f448b1e87422449bfc7dba42c29 Mon Sep 17 00:00:00 2001
From: Olly Betts <address@hidden>
Date: Wed, 5 Mar 2014 10:53:51 -0700
Subject: [PATCH] Use ldconfig to generate sys_lib_dlsearch_path_spec.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use ldconfig to generate sys_lib_dlsearch_path_spec so that internal library
search paths as well as all /etc/ld.so.conf and /etc/ld.so.conf.d/*.conf
entries are present.
http://article.gmane.org/gmane.comp.gnu.libtool.general/12121
Co-authored-by: Christian Rössel <address@hidden>
Signed-off-by: Orion Poplawski <address@hidden>
---
m4/libtool.m4 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index ce58f31..daf71bf 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2738,10 +2738,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; skip = 0; }' <
/etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/
/g;s/=[^=]*$//;s/=[^= ]* / /g;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'|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
--
1.8.5.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH] Use ldconfig to generate sys_lib_dlsearch_path_spec,
Orion Poplawski <=