[Top][All Lists]

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

Re: shared library from smaller pieces

From: Ralf Wildenhues
Subject: Re: shared library from smaller pieces
Date: Sun, 4 Dec 2005 17:08:50 +0100
User-agent: Mutt/1.5.11

Hi Vlad,

* Vlad Skvortsov wrote on Sun, Dec 04, 2005 at 08:01:45AM CET:
> I use automake/libtool environment for a project with couple of dozens 
> of libraries. I link those libraries statically into the binaries that 
> are then distributed. It works ok.
> What I need now is to create a shared library that would contain a 
> subset of those smaller libraries. Say, I want to pack the contents of 
>, and into libbig, and libbig has to be 
> shared (it will be distributed in binary form).
> When I use something like this:
> libbig_la_LIBADD = .../ .../ .../
> I end up with the shared library that contains _references_ to _shared_ 
> libraries aaa, bbb and ccc. But I just want their contents to be packed 
> inside.
> How can I achieve that?

You make the other libraries into `convenience archives'.  These are
documented in both
  info Automake 'A Shared Library'
  info Libtool 'Static libraries'

Short: noinst_LTLIBRARIES creates these, they contain objects with PIC
code.  You'd do:

  noinst_LTLIBRARIES =
  libbig_la_LIBADD = ./ ./ ./

Now I guess you *also* want to build the program as will, with the stuff
linked in statically.  You *can* do

  bin_PROGRAMS = foo
  foo_LDADD = ./ ./ ./

and it will likely work fine, on many platforms.  *However*:  It's not
totally portable, it will actually link PIC objects into your program,
thus the program will be a bit slower than with non-PIC objects, and
of course you should not let foo get anywhere close to libbig, as then
you'll have fun with duplicate symbols.

Does that help you?


reply via email to

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