libtool
[Top][All Lists]
Advanced

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

LDFLAGS / LDADD / LIBADD (was: libtool / C++ / inter library dependencie


From: Michael Forster
Subject: LDFLAGS / LDADD / LIBADD (was: libtool / C++ / inter library dependencies)
Date: Wed, 4 Oct 2000 21:39:39 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Another question:

What is the difference between 

        xy_LDFLAGS = -lz

and 

        xy_LDADD = libz.la

and which of them should I use? Please just ignore the -L and -R flags and
the library path for this case. I know (I hope :-) how to handle them.

I have this situation:
  * Library    liba.la
  * Library    libb.la  depends on liba.a
  * Exceutable c        depends on liba.la and libb.la

i.e. in the dynamic case c should automatically load liba and libb, and
libb should automatically load liba when dlopened. In the static case, c
should include liba and libb, but libb should not include liba.

There are two solutions I have come to:

lib_LTLIBRARIES = liba.la libb.la
bin_PROGRAMS = c

liba_la_SOURCES = a.cpp
libb_la_SOURCES = b.cpp
c_SOURCES = c.cpp

1)

libb_la_LDFLAGS = -la
c_LDFLAGS = -la -lb

2)

libb_la_LIBADD = liba.la
c_LDADD = liba.la libb.la

Both solutions do what I wanted them to do, the libtool documentation
suggests Method 2):

 First, to link a program against a libtool library, just use the
`program_LDADD' variable:

     bin_PROGRAMS = hell
     
     # Build hell from main.c and libhello.la
     hell_SOURCES = main.c
     hell_LDADD = libhello.la

But If I use Method 2) in my case I get the following warning:

ld: warning: file /home/brscratch/forster/at-test/.libs/liba.so: linked to
./.libs/liba.so: attempted multiple inclusion of file

with method 1) I do not. So what should I do? Ignore the warning? Use
Method 1? My problem is that I don't understand the semantical difference
beween 1) and 2). 

[If there's some documentation about this topic I have missed, I'd also be
happy to be pointed to that]

Environment:
  CVS autoconf, CVS automake, CVS ML Libtool, 
  gcc 2.95.2, Solaris 8

Thanks in advance,

Mike

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBOdt5bMeYjj0YYPBiEQK4vgCfTDgydpsPOid37gphpM7iRQygd68AoPIP
IVPwmUx5T3K3ZrFHez5JzmDr
=AZB8
-----END PGP SIGNATURE-----




reply via email to

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