libtool
[Top][All Lists]
Advanced

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

Re: Linking with -lname key


From: Bob Friesenhahn
Subject: Re: Linking with -lname key
Date: Sun, 7 Jun 2020 08:09:08 -0500 (CDT)
User-agent: Alpine 2.20 (GSO 67 2015-01-07)

On Sun, 7 Jun 2020, Vict wrote:

Hello. Sorry if I didn't study the documentation well, but I don't understand
the following aspect: why does libtool not link to its own la archives when
linking with a -lname key?

Since you mention /usr/local/lib, can you confirm that LDFLAGS includes -L/usr/local/lib or that this argument was otherwise supplied to libtool?

Let's link a test program with libmy:
$ libtool --tag=CXX --mode=link g++ -o test_app  test_app.o -lmy
test_app does not become dependent on libflt and libEGL (they are not in the
dynamic section labeled "NEEDED".
Linking test_app with absolute path to libmy does:
$ libtool --tag=CXX --mode=link g++ -o test_app  test_app.o
   /usr/local/lib/libmy.la

but relying on absolute path is bad. I can’t know in advance
where the library will be installed (/usr/lib, /usr/local/lib, ...).

By "know in advance", do you mean that as a software developer you can't know the configuration of some other system while building, or do you mean that the libraries may be installed to some random locations?

Note that when libtool is used to install libraries, it may re-link the libraries so that the results are different than with "--mode=link".

You should also consider that the operating system may or may not search the directory containing the shared libraries. If it does not search the directory (e.g. /usr/local/lib in your case) and there is no run search path in the dependent library, then the dependent program won't run.

You should confirm if the libtool you are using is as delivered from the FSF release, or if it is a modified version. Modified versions which change how library dependencies are treated abound.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

reply via email to

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