[Top][All Lists]

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

RE: adding libraries and header file directories

From: Jim Rainville
Subject: RE: adding libraries and header file directories
Date: Tue, 7 Nov 2006 17:52:08 +0100

Hi Ralf - 

You mention below that if I'm not using libtool I can just add the
libraries twice, but what if I am using libtool? I'm combining two
different software packages - the one I want to build uses libtool and
the libraries I want to add have the circular dependencies. I'm pushing
on the development team that developed the libraries to get rid of the
circular dependencies but for now I'm stuck with what I have. 
So, I tried to do both: add the --start-group/--end-group and add the
libraries twice (I also tried them each individually also). I have
attached the link line below. You can see that in the call to libtool
the --start-group/--end-group flags are there and they are in the
correct position. Also you can see that all the libraries are there
twice (all my libraries start with elem_). But then when it actually
does the link (I think) the flags seem to have been sorted and the
libraries are only listed once. 
I'm guessing that libtool has the "intelligence" to do sort the flags
and figure out that libraries are listed more then once and it does what
it thinks is the right thing. Is there anyway to get around this with

Thanks for any help you can offer.

/bin/sh ./libtool --mode=link --tag=CC gcc -Wsign-compare -Wall -pipe -o
vlc vlc-vlc.o src/libvlc.a -Wl,--start-group -lelem_chkpt_api
-lelem_chmgmt_api -lelem_core_api -lelem_mobj_api -lelem_fault_api
-lelem_rel_api -lelem_chkpt_api -lelem_chmgmt_api -lelem_core_api
-lelem_mobj_api -lelem_fault_api -lelem_rel_api -lelement_callouts
-llinx -Wl,--end-group ./modules/misc/memcpy/libmemcpymmx.a
./modules/misc/memcpy/libmemcpy3dn.a ./modules/mux/mpeg/libmux_ts.a
-L/usr/local/lib -g -lrt -lpthread -ldl -lm -ldvbpsi
mkdir .libs
gcc -Wsign-compare -Wall -pipe -o vlc vlc-vlc.o -Wl,--start-group
-Wl,--end-group -g  src/libvlc.a -lelem_chkpt_api -lelem_chmgmt_api
-lelem_core_api -lelem_mobj_api -lelem_fault_api -lelem_rel_api
-lelement_callouts -llinx ./modules/misc/memcpy/libmemcpymmx.a
./modules/misc/memcpy/libmemcpy3dn.a ./modules/mux/mpeg/libmux_ts.a
-L/usr/local/lib -lrt -lpthread -ldl -lm /usr/local/lib/
-L/home/jim/work_area/element/linx/linx-1.0.1/lib -Wl,--rpath
-Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib

-----Original Message-----
From: Ralf Wildenhues [mailto:address@hidden 
Sent: Monday, November 06, 2006 12:43 PM
To: Jim Rainville
Cc: mick; address@hidden
Subject: Re: adding libraries and header file directories

Hello Jim, Mick,

* Jim Rainville wrote on Mon, Nov 06, 2006 at 02:46:12PM CET:
> This was very helpful. It got me off the ground and now I think I'm
> about 90% there. What I'm struggling with now is circular dependencies
> in libraries. In the old Makefile for this software they dealt with
> in this fashion:
> -Wl,--start-group <libs> -Wl,--end-group
> With autoconf/automake this won't work because you're supposed to add
> linker flags with the _LDFLAGS macro and when you do that it's not
> positional.

If you're not using Libtool:  just mention the library/libraries twice.
But the real solution is to get rid of the circular dependencies.  It's
not portable to have them.  -Wl,--start-group is limited to GNU binutils
ld, so that's a lot less portable even.

> From: mick [mailto:address@hidden 
> On Sun, 5 Nov 2006 02:36, you wrote:
> >
> > ... -I$(path_to_my_headers) -L$(path_to_my_libraries) element_hal
> > element_sal ...
> I have used:-
> bin_PROGRAMS = gyachi
> gyachi_SOURCES = \
> ...
> INCLUDES = -I/usr/include/gtkhtml-2.0 -I/usr/include/libxml2

AM_CPPFLAGS is a non-anachronistic way of spelling INCLUDES in files.  But you don't want to spell out absolute paths in
such a file like that anyway if you want your program to be portable
(your next user will have gtkhtml 2.1 installed below /opt/foobar, and
libxml below her $HOME).  Libraries like that usually make their flags
known in some way, either an Autoconf macro they ship and you can use,
(the Autoconf Macro Archive has one of those), or e.g., pkg-config.

Otherwise there is of course still the possibility for the user of your
package to
  ./configure \
    CPPFLAGS='-I/usr/include/gtkhtml-2.0 -I/usr/include/libxml2' \
    LDFLAGS='-L/opt/foobar/lib ...'

Hope that helps.


reply via email to

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