[Top][All Lists]

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

Re: Shared library - static link specific dependency

From: Ralf Wildenhues
Subject: Re: Shared library - static link specific dependency
Date: Sat, 14 Jun 2008 10:57:13 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Alon, and sorry for the delay,

* Alon Bar-Lev wrote on Fri, Jun 06, 2008 at 09:15:37AM CEST:
> >  > I want to make a shared library without dependencies. I compile the
> >  > dependencies in PIC mode, so it should be compatible.

> Let's say I have pointing to* and liba.a(pic)
> installed in my system. I am not building this right now.
> Now, I would like to create that use liba but I do not want
> to have external dependency of*.

Ah, ok.  Libtool doesn't really support this.  Well, only with
convenience archives, but not with installed stuff.  Here's why:

The general idea is that you should not have multiple entities
of the same code in different libraries, as this can lead to
subtle and difficult-to-analyze bugs.  Either your libraries are
shared (and its dependencies are, too), or your libraries are
static, and their code will end up in the final program (but not
in other libraries depending on it).  This is how libtool handles
shared libraries and shared modules, and also how it handles
static libraries and dlpreopened modules.  Of course the latter
only work with libltdl.

This is also the reason why installing convenience archives is
discouraged: it makes it easy to end up with code being duplicated
into several libraries.

(I suppose you could hack around this by manually copying and $(LT_OBJDIR)/libconvenience.a into some installed
location, and use that later; but again, be warned).  Maybe libtool
should support this (I think it did at one point in the past), but add a
big fat warning sign.  Hmm.


reply via email to

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