libtool
[Top][All Lists]
Advanced

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

Cyclic dependencies


From: Thomas Maier
Subject: Cyclic dependencies
Date: 12 Jun 2003 11:55:39 +0200

Hi all,

I think I have a problem with libtool and cyclic dependencies.  Say, I
want to build two libraries a.la and b.la.  a uses things from b and
vice versa.  When compiling these libs without libtool, first I compile
one, then the other.  When linking a program p that uses a *or* b, I
have to link p with a *and* b.  Fine.  I only checked that because I had
problems with libtool.  Who wants to build libraries without libtool? :)

Now, say I have compiled the libs with libtool.  When I use libtool to
link p with a *or* b, I guess libtool would be clever enough to use its
interlibrary dependency information and make life easier by
automatically linking with the other lib (b or a, respectively), too. 
After all, that is what dependency_libs is for in the .la files, right?

Well, problem is I never get this far.  When building a and say
LIBS="$LIBS -lb" in a's configure.ac, libtool complains because there is
no b.la, yet.  If it were and if it included -la in dependency_libs,
things would not get any better because libtool would then complain
about the missing a.la which it is just trying to build.

So what I am doing right now is removing the -lb in a's LIBS and the -la
in b's LIBS and everything compiles.  But of course I lose dependency
information.  When I compile p with a, libtool cannot figure out anymore
to also link with b.

My question is of course "ho do I get everything?" :).  I am using
$ libtool --version
ltmain.sh (GNU libtool) 1.4.3 (1.922.2.111 2002/10/23 02:54:36)
$ uname -a
Linux spock 2.4.21-rc3 #2 SMP Sat Jun 7 14:49:59 CEST 2003 i686 Mobile
Intel(R) Pentium(R) 4 - M CPU 2.40GHz GenuineIntel GNU/Linux

I have not found anything in the docs (neither in libtool.info nor in
the autobook nor on the mailing list nor with google) but that cyclic
dependencies are not portable.  I guess as a linux-only user I am kind
of ignorant or, well, at least a newbie to portability things.  Not even
talking about proper desgin here.

The only hack I quickly thought of is ripping out the -l flags during
the build (that's what I do right now to get things compiled) and then
hacking the .la files afterwards :(.  Maybe there is a clean way for
specifying libs that the current one depends on when being linked with
but that are not used when building the lib itself?

I would appreciate pointers very much and of course even more a proper
solution to that.  I would also offer to write a couple of lines for the
documentation.  Or clarify things if it is already there and I missed
it.  Afer all, it is a great tool ;).

advTHANKSance and regards, Thomas.

-- 
Thomas Maier <address@hidden>





reply via email to

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