[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)


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-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 ../libevent/  is a convenience  library. ../libevent/  is not
(it  has   a  libdir   defined).  dependency_libs  for  is
"-lrt".  There is nothing  for will get "-lrt"
as dependency_libs.

I would  expect that either will be put  in dependency_libs
(like  if  it  was  a  dynamic  library)  or  to  be  incorporated  into (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://
cd lldpd
git checkout 0.6.0

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 ☯

Don't comment bad code - rewrite it.
            - The Elements of Programming Style (Kernighan & Plauger)

reply via email to

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