libtool
[Top][All Lists]
Advanced

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

Re: libtool setting DT_RPATH in .libs/lt-foo binaries


From: Roger Leigh
Subject: Re: libtool setting DT_RPATH in .libs/lt-foo binaries
Date: Sat, 20 Dec 2003 23:49:56 +0000
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Bob Friesenhahn <address@hidden> writes:

> On Sat, 20 Dec 2003, Roger Leigh wrote:
>>
>> /usr/lib has been hard-coded into the DT_RPATH!  This is because the
>> program was linked with the output of `cups-config --image --libs`:
>>
>>   -lcupsimage -ltiff -ljpeg -lpng -lm -lz -lcups -L/usr/lib -lgnutls -lnsl
>
> This is a classic problem with *-config scripts and why configure
> scripts I write intentionally ignore --libs and --cflags output from
> these scripts.  Config scripts should never include "standard" include
> and lib directories, but unfortunately this happens far too often.

I see.  Perhaps I need to manually strip this out of the output as a
workaround.  I've done this like so:

CUPS_LIBS=`echo \`$CUPS_CONFIG --ldflags\` \`$CUPS_CONFIG --image --libs\` | 
sed -e 's/-Wl,-rpath,\/usr\/lib//g' -e 's/-L\/usr\/lib//g'`

It's ugly, but if we're working around a bug in that script, there
isn't much choice.

>> On older systems which don't have '-L/usr/lib' the problem is not seen.
>>
>> $ grep CUPS_LIBS config.status
>> address@hidden@%-Wl,-rpath,/usr/lib -lcupsimage -ltiff -ljpeg -lpng -lm -lz 
>> -lcups -L/usr/lib -lgnutls -lnsl%g
>> $ grep CUPS_LIBS src/cups/Makefile
>> CUPS_LIBS = -Wl,-rpath,/usr/lib -lcupsimage -ltiff -ljpeg -lpng -lm -lz 
>> -lcups -L/usr/lib -lgnutls -lnsl
>>             ^^^^^^^^^^^^^^^^^^^
>> Here something (I assume libtool) has taken it into its head to put
>> /usr/lib in the RPATH.  Is there any way to prevent this?
>
> This is not libtool's fault!  Libtool is not responsible for the
> content of your Makefile so I have to presume that something else is
> adding the -Wl,-rpath,/usr/lib to your CUPS_LIBS variable.
> Regardless, this option effects the library used a run-time, not at
> link time.

True.  It's just that I need to run the program during the build--and
ensure that my built version of the library, not the previously
installed verision, is used.  I wasn't knocking libtool BTW--it was a
symptom, but not the cause!

> If you need to link against a library located somewhere other than
> /usr/lib then you should ensure that a -L option to that location is
> listed prior to the bogus -L/usr/lib.  Also, the linker normally
> chooses shared libraries over static libraries, regardless of the
> linker search path (it scans the path twice), so it may take
> additional steps to ensure that the correct library is used.

The library will be located in the build tree, but I don't want the
path to the library in the build tree in the installed binary.

There are no problems if I use --disable-shared, but if
--enable-shared is used, it always links shared.

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]