libtool
[Top][All Lists]
Advanced

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

Re: Developing against $HOME/lib libraries and LD_LIBRARY_PATH


From: Thomas Jahns
Subject: Re: Developing against $HOME/lib libraries and LD_LIBRARY_PATH
Date: Thu, 30 Nov 2017 15:38:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Posting again, since at the first attempt I only sent directly to Paul.

On 11/22/17 15:45, Paul "LeoNerd" Evans wrote:
On Thu, 16 Nov 2017 14:49:01 -0500
Nick Bowler <address@hidden> wrote:

If that is not happening then maybe the libraries and/or programs are
being linked incorrectly, or perhaps there's a bug in libtool.

Example:

build+install libfoo to non-system location:
   % libtool --tag=CC --mode=compile gcc -c foo.c
   % libtool --tag=CC --mode=link gcc -rpath /tmp/instlib -o libfoo.la
foo.lo % libtool --mode=install cp libfoo.la /tmp/instlib

build libbar, linked against libfoo:
   % libtool --tag=CC --mode=compile gcc -c bar.c
   % libtool --tag=CC --mode=link gcc -rpath /usr/local/lib -o
libbar.la \ bar.lo /tmp/instlib/libfoo.la

build application linked against uninstalled libbar:
   % libtool --tag=CC --mode=compile gcc -c app.c
   % libtool --tag=CC --mode=link gcc -o app app.lo libbar.la

Inspection of results:
   % ldd .libs/app
   [...]
   libbar.so.0 => not found
   libfoo.so.0 => /tmp/instlib/libfoo.so.0 (0x00007fec8f7a9000)

   [we see that that the executable has the nonstandard location for
libfoo, and libbar is not installed so it is not found by ldd, and
finally...]

   % libtool --mode=execute ./app
   [works correctly]

Ah interesting. I see a number of `-rpath` arguments in theabove, which
I don't have in my case. I wonder if that explains it. Should the .pc
file from the first library be emitting that as part of the --libs
output then?

The -rpath argument is for libtool (to tell it where the library will be installed). To tell libtool (or ld) where to search for libraries at run-time (if no .la files are installed) one needs to add -R or -Wl,-rpath options.

Regards, Thomas


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

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