[Top][All Lists]

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

Re: shared library from smaller pieces

From: Vlad Skvortsov
Subject: Re: shared library from smaller pieces
Date: Sun, 04 Dec 2005 20:34:04 -0800
User-agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317)

Ralf Wildenhues wrote:
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'

Oh, I've overlooked that.. Actually I though that the way objects are packed into particular library is defined in the target library rules and not in dependent ones.

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.

And what is "the right way" to do it, then?

Does that help you?

Yes, thanks a lot!


Vlad Skvortsov, address@hidden, address@hidden

reply via email to

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