[Top][All Lists]

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

Re: Building a static library consisting of libraries

From: Ralf Wildenhues
Subject: Re: Building a static library consisting of libraries
Date: Mon, 12 Jun 2006 12:57:53 +0200
User-agent: Mutt/1.5.11

Hello Norbert,

* Norbert Sendetzky wrote on Mon, Jun 12, 2006 at 12:02:06PM CEST:
> I ran into a rather tricky problem, but let me explain a little bit more in 
> detail first:
> I've created a library (opendbx, a unified database layer) which uses backend 
> libraries (like to interface the native database library 
> (
> Now I want to create a static libopendbx.a which contains the main library 
> and 
> all backend libraries. The problem is that I have to compile the all objects 
> twice, once with libopendbx_la_LDFLAGS="-module -version 1:0:0" and a second 
> time with libopendbx_a_CPPFLAGS="-ODBX_STATIC" and binding them to a single 
> library fails.

Mixing Libtool and non-Libtool libraries isn't the best idea.  Better to
mix libtool libraries

and libtool static libraries
  libbar_la_LDFLAGS = -static

and libtool convenience archives
  noinst_LTLIBRARIES =

> Building the static libraries individually works but binding the libopendbx 
> object with the libXXXbackend.a libraries fails (nm tells me that the file 
> format for the backends is unknown). If I list the object files in 
> libopendbx_a_LIBADD instead, it works but it contains no dependency 
> information about the native libraries. So I've tried to build separate 
> static backend libraries ( with dependency informations 
> instead, but linking fails also miserably ("ar cru" can only handle objects).
> The big question now: Is there a way to get around this?

Yes.  Convenience archives get incorporated into other libraries.
Static and shared libraries get dependency information.  Both the
Automake and the Libtool manual have much more information.

If with this information you still get errors, then please show
what's going wrong in more detail (link command lines plus output,
and/or snippets; cut and paste is much more helpful
than describing errors; of course a reproducible example is best).


reply via email to

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