[Top][All Lists]

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

Including static libraries in shared libraries with libtool.

From: Sam Varshavchik
Subject: Including static libraries in shared libraries with libtool.
Date: Sat, 25 Sep 2004 22:49:15 -0400

I'm trying to do the following with libtool, and it's not quite doing exactly what I want. Can someone suggest the correct way to do the following, with libtool 1.5.6 and automake 1.8.3 on Linux:

I'm building several shared libraries. These shared libraries use common code from several static libraries, which I'll refer to as component libraries. Here's an example component library:

libauth_la_SOURCES=auth.h authexit.c chain.c checkpassword.c \
                  [ more sources go here ]
libauth_la_LDFLAGS=-static is not going to get installed by the final application. It's an internal library whose only intended purpose is to provide some common code for a bunch of shared libraries that will be installed.

Here's one such shared library:

libauthuserdb_la_SOURCES=authuserdb.c preauthuserdb.c \
                       [ more sources ]

My intentions here are:

Build the sources for Take their object code, and grab whatever modules from that are references by stuff in, and place all of that into a shared library.

In other words: look up all unresolved symbols from's sources which can be found in the Take whatever modules from that needs, and generate a .so containing libauthuserdb_la_SOURCES plus whatever the sources need that can be found in libauth.a

Unfortunately, the actual results are different.  There are two problem:

1. Libtool takes _all_ modules from, and puts them into I only want the modules that actually needs.

2. For some reason, only the static version of is generated. I don't know why, but is not created, only libauthuserdb.a is created. I am _not_ using the --disable-shared flag with the configure script.

I'd like to come up with a solution to do what I want without rearchitecturing the source. Of course, I could simply take the requisite libauth_la_SOURCES, manually add them to libauthuserdb_la_SOURCES, and build a garden-variety shared library, without a dependency on a static library.

However, this is not practical. I'm building several shared libraries that use different bits and pieces of the common code, and manually tracking which common source module is used by which shared library is cumbersome. I need to coerce libtool in doing this job for me.

Attachment: pgp_JNWdhW2kg.pgp
Description: PGP signature

reply via email to

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