GNU bug report logs - #24296
lt wrapper script puts the .libs rpath last instead of first

Previous Next

Package: libtool;

Reported by: Ray Satiro <raysatiro <at> yahoo.com>

Date: Wed, 24 Aug 2016 05:37:01 UTC

Severity: normal

To reply to this bug, email your comments to 24296 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#24296; Package libtool. (Wed, 24 Aug 2016 05:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ray Satiro <raysatiro <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Wed, 24 Aug 2016 05:37:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ray Satiro <raysatiro <at> yahoo.com>
To: bug-libtool <at> gnu.org
Subject: lt wrapper script puts the .libs rpath last instead of first
Date: Wed, 24 Aug 2016 01:31:44 -0400
I am building a shared library and a program that uses it and I need to 
run it uninstalled. libtool creates a lt- version of the program with an 
rpath to the uninstalled shared library, but the problem is I also set 
rpaths and libtool puts its rpath after mine instead of before.

I build curl in Ubuntu similar to this:

LDFLAGS="-Wl,-rpath,/usr/local/ssl/lib -Wl,-rpath,/usr/local/lib" 
./configure [OPTIONS REMOVED FOR BREVITY]
make

I end up with

lib/.libs/libcurl.so
src/curl    <--- libtool wrapper script
src/.libs/lt-curl

When I run src/curl it execs lt-curl which has an rpath for 
/usr/local/lib before lib/.libs, and so it loads the libcurl.so from 
/usr/local/lib. Reviewing the wrapper script I can see libtool appends 
its rpath instead of putting it first. relink-command looks basically 
like this:

gcc -O2 -Wno-system-headers -Wl,-rpath -Wl,/usr/local/ssl/lib -Wl,-rpath 
-Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -o \$progdir/\$file 
[OBJECTS REMOVED FOR BREVITY] -L/usr/local/ssl/lib -L/usr/local/lib 
../lib/.libs/libcurl.so -lssl -lcrypto -lz -Wl,-rpath 
-Wl,/home/owner/curl-7.50.1/lib/.libs

I initially reported this to the cURL project, which I am a part of. The 
bug is https://github.com/curl/curl/issues/432 but I couldn't figure it out.

I attempted to work around this problem when I know src/curl is used by 
using LD_PRELOAD, like

LD_PRELOAD=$PWD/lib/.libs/libcurl.so make test

Recently though I realized a bunch of our tests are overriding 
LD_PRELOAD, and I don't have a work around for those cases at the moment.

I believe appending the lib/.libs rpath instead of prepending it could 
be a bug in libtool.

libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1
Ubuntu 16 LTS
4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 
x86_64 x86_64 GNU/Linux





Information forwarded to bug-libtool <at> gnu.org:
bug#24296; Package libtool. (Wed, 28 Jun 2017 04:38:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ray Satiro <raysatiro <at> yahoo.com>
To: bug-libtool <at> gnu.org
Subject: Re: lt wrapper script puts the .libs rpath last instead of first
Date: Tue, 27 Jun 2017 21:55:35 -0400
On 8/24/2016 1:31 AM, Ray Satiro wrote:
> I am building a shared library and a program that uses it and I need
> to run it uninstalled. libtool creates a lt- version of the program
> with an rpath to the uninstalled shared library, but the problem is I
> also set rpaths and libtool puts its rpath after mine instead of before.
>
> I build curl in Ubuntu similar to this:
>
> LDFLAGS="-Wl,-rpath,/usr/local/ssl/lib -Wl,-rpath,/usr/local/lib"
> ./configure [OPTIONS REMOVED FOR BREVITY]
> make
>
> I end up with
>
> lib/.libs/libcurl.so
> src/curl    <--- libtool wrapper script
> src/.libs/lt-curl
>
> When I run src/curl it execs lt-curl which has an rpath for
> /usr/local/lib before lib/.libs, and so it loads the libcurl.so from
> /usr/local/lib. Reviewing the wrapper script I can see libtool appends
> its rpath instead of putting it first. relink-command looks basically
> like this:
>
> gcc -O2 -Wno-system-headers -Wl,-rpath -Wl,/usr/local/ssl/lib
> -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -o
> \$progdir/\$file [OBJECTS REMOVED FOR BREVITY] -L/usr/local/ssl/lib
> -L/usr/local/lib ../lib/.libs/libcurl.so -lssl -lcrypto -lz -Wl,-rpath
> -Wl,/home/owner/curl-7.50.1/lib/.libs
>
> I initially reported this to the cURL project, which I am a part of.
> The bug is https://github.com/curl/curl/issues/432 but I couldn't
> figure it out.
>
> I attempted to work around this problem when I know src/curl is used
> by using LD_PRELOAD, like
>
> LD_PRELOAD=$PWD/lib/.libs/libcurl.so make test
>
> Recently though I realized a bunch of our tests are overriding
> LD_PRELOAD, and I don't have a work around for those cases at the moment.
>
> I believe appending the lib/.libs rpath instead of prepending it could
> be a bug in libtool.
>
> libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1
> Ubuntu 16 LTS
> 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64
> x86_64 x86_64 GNU/Linux
>

Hi I e-mailed this over 10 months ago but have not received a reply,
does it have an official bug number or ticket, is anyone aware of it?




This bug report was last modified 7 years and 360 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.