Reputation: 99
Having spent most of my development career in IDE I'm currently attempting to extend an Opensource project C-ICAP that uses Autoconf and Automake, so this may be a glaringly obvious answer to those more familiar with this toolset. I'm attempting to add a new service to the ICAP service that uses our proprietary shared library but can't work out the necessary updates to the Makefile.am to add our library to the link operation of the new service.
I need to create the equivalent of
-lmylibrary
I've tried the following,
LDADD = mylibrary
LDADD = libmylibrary.so
LIBADD = mylibrary
LIBADD = libmylibrary.so
but when I 'make' the project, there is no mention of 'mylibrary' in the build log. When I tried
LIBS = mylibrary
'mylibrary' appeared in the build log, but running ldd
on the built .so file did not include 'mylibrary'.
The project is being installed onto an Ubuntu host.
Our 'libmylibrary.so' is installed into /usr/lib
.
I am running the following sequence of commands after updates to the Makefile.am
aclocal
autoconf
automake --add-missing
./configure --with-c-icap=/usr/local/c-icap --prefix=/usr/local/c-icap
make
What am I missing to enable the new service to link to the installed shared libary?
Upvotes: 1
Views: 1899
Reputation: 3240
Since you're trying to add this to a shared object build, what you're looking for is libfoo_la_LIBADD = -lmylibrary
. LIBADD
as a global in Makefile.am
is not supported.
Note that by default the link editor nowadays discards any library added to the linking line if they are not used to satisfy undefined symbols in the source objects. If you want to force linking to your library, you'd have to use libfoo_la_LIBADD = -Wl,--no-as-needed -lmylibrary -Wl,--as-needed
, but that might complicate the build quite a bit.
Upvotes: 2