libtool
[Top][All Lists]
Advanced

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

Linking with -lname key


From: Vict
Subject: Linking with -lname key
Date: Sun, 7 Jun 2020 15:26:01 +1000

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?
$ ls /usr/local/lib
libmy.a  libmy.la  libmy.so  libmy.so.0  libmy.so.0.0.0
libmy specifically made it dependent on libfltk and libEGL.
$ readelf -a /usr/local/lib/libmy.so | grep NEEDED
 (NEEDED)             Shared library: [libfltk_SHARED.so.1.4]
 (NEEDED)             Shared library: [libEGL.so.1]
...
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, ...).

reply via email to

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