libtool
[Top][All Lists]
Advanced

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

Conflict between autoconf and libtool way of handling libraries (try 2)


From: Carlo Wood
Subject: Conflict between autoconf and libtool way of handling libraries (try 2)
Date: Tue, 28 Nov 2000 03:22:23 +0100
User-agent: Mutt/1.2.5i

Hi again,

nobody addressed the mail that I wrote a month ago, included again below,
it is still a problem for me however.

What is the right way of doing this?  Or is indeed
something that is actually a problem with libtool?

On Thu, Oct 26, 2000 at 03:31:04PM +0200, Carlo Wood wrote:
> autoconf handles libraries as if libtool doesn't exist:
> ./configure figures out which libraries are needed and
> LIBS is set accordingly in *all* generated Makefiles.
> 
> The idea behind this is that libraries that are needed are
> needed everywhere: also when compiling tests.
> 
> [ Meaning: if libfoo needs libbfd, then libfoo is
>   compiled with -lbfd, and tests are compiled with
>   -lfoo -lbfd. ]
> 
> However, when building a library yourself with libtool
> that uses libraries on its own then the libraries needed
> by the library that is being build should not be passed
> on to the tests that link with the built library.
> 
> For example, in my case:
> 1) I build libcwd.la (which depends on -lbfd -liberty)
> 2) I build libcw.la which depends on ../libcwd/libcwd.la
> 
> next I want to compile a test program that depends on
> libcw.la and it gets linked with ../libcwd/libcwd.la too
> because LIBS was set to `../libcwd/libcwd.la' during the
> configuration of libcw!
> 
> That does not only fail (because the relative path is nonsense
> in the test directory) it is also essentially wrong because
> the dependency on libcwd is supposed to be passed by libtool,
> not by autoconf (by means of "passing on" the LIBS environment
> variable).
> 
> [ I get:
> 
> ~/c++/libcw-objdir/src/libcw/io/tests>make burst_tst
> g++ -DHAVE_CONFIG_H -I- -I../../include 
> -I../../../../../libcw/src/libcw/io/tests/../../include    -DDEBUG -g 
> -fno-exceptions -pipe -Wall -Woverloaded-virtual -Wundef -Wpointer-arith 
> -Winline -Wwrite-strings -Werror -c 
> ../../../../../libcw/src/libcw/io/tests/burst_tst.cc
> /bin/sh ../../libtool --mode=link g++  -DDEBUG -g -fno-exceptions -pipe -Wall 
> -Woverloaded-virtual -Wundef -Wpointer-arith -Winline -Wwrite-strings -Werror 
>  -o burst_tst  burst_tst.o ../../libcw.la ../libcwd/libcwd.la 
> mkdir .libs
> libtool: link: cannot find the library `../libcwd/libcwd.la'
> 
> Where "../libcwd/libcwd.la" shouldn't be there at all
> (it is the LIBS that was needed to build libcw in
>  ~/c++/libcw-objdir/src/libcw).
> ]
> 
> The only work-around seems to be to put a new configure.in file in every
> test directory.  This is hardly acceptable because that would increase
> the size of the tarball dramatically (a `configure' script is LARGE).
> 
> There must be better way, I hope.
> 

Please ask me to clarify when needed.

-- 
Carlo Wood <address@hidden>



reply via email to

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