[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Convenience library and non convenience library linking
From: |
Vincent Bernat |
Subject: |
Convenience library and non convenience library linking |
Date: |
Fri, 04 May 2012 22:24:23 +0200 |
User-agent: |
Gnus/5.130004 (Ma Gnus v0.4) Emacs/23.4 (x86_64-pc-linux-gnu) |
Hi!
I have some doubts on why libtool does not add a libtool archive to the
list of dependencies of a convenience library. Here is how it is
invoked in my project:
/bin/bash ../libtool --tag=CC --mode=link gcc -I../../libevent/include
-I../libevent/include -g -O2 -fdiagnostics-show-option -std=gnu99 -pipe -Wall
-W -Wextra -Wformat -Wformat-security -Wcast-align -Winline -fstack-protector
-D_FORTIFY_SOURCE=2 -Wdeclaration-after-statement -Wno-unused-parameter
-Wno-sign-compare -Wl,-z,relro -Wl,-z,now -o liblldpd.la liblldpd_la-frame.lo
liblldpd_la-lldpd.lo liblldpd_la-lldp.lo liblldpd_la-cdp.lo
liblldpd_la-sonmp.lo liblldpd_la-edp.lo liblldpd_la-interfaces.lo
liblldpd_la-client.lo liblldpd_la-priv.lo liblldpd_la-privsep_fdpass.lo
liblldpd_la-dmi.lo liblldpd_la-event.lo libcommon.la ../libevent/libevent.la
libcommon.la is a convenience library. ../libevent/libevent.la is not
(it has a libdir defined). dependency_libs for libevent.la is
"-lrt". There is nothing for libcommon.la. liblldpd.la will get "-lrt"
as dependency_libs.
I would expect that either libevent.la will be put in dependency_libs
(like if it was a dynamic library) or to be incorporated into
liblldpd.la (like if it was a convenience library). Since I get nothing,
I will need to add it to the linking phase of a real object later.
If you want to see the real example:
git clone git://github.com/vincentbernat/lldpd.git
cd lldpd
git checkout 0.6.0
./autogen.sh
You need to try without libevent 2.x installed on your system so that it
uses the embedded copy. It works because I have also added the libtool
archive in LDFLAGS for the final binary.
Thanks for any insight!
--
Vincent Bernat ☯ http://vincent.bernat.im
Don't comment bad code - rewrite it.
- The Elements of Programming Style (Kernighan & Plauger)
- Convenience library and non convenience library linking,
Vincent Bernat <=