libtool
[Top][All Lists]
Advanced

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

Re: Cyclic dependencies


From: Bob Friesenhahn
Subject: Re: Cyclic dependencies
Date: Thu, 12 Jun 2003 11:03:56 -0500 (CDT)

On 12 Jun 2003, Thomas Maier wrote:

> 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

Uugh.  Even without libtool, creating libraries with interdependencies
causes portability problems because some linkers (which even includes
linkers in older versions of Linux) require that the libraries be
listed in inverse dependency (left to right) order.  You would find
that these primitive linkers would require

 -la -lb -la

or even

 -la -lb -la -lb -la

as many times as required to resolve the cross-dependencies, as they
are evaluated, in order to resolve all of the symbols.

Don't do that if you can help it.

One thing you can do is that if library 'b' can be considered
subordinate to library 'a' (or treated that way), you can build
library 'b' as a libtool "convenience library" so that its contents
are included in library 'a' when library 'a' is linked with library
'b'.  Library 'b' is never installed.  This avoids the
cross-dependency problem, but does that by including the objects from
library 'b' in library 'a'.

Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen





reply via email to

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