automake
[Top][All Lists]
Advanced

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

Setup automake to build dynamic library (.so) linking several other libr


From: tomoyo255
Subject: Setup automake to build dynamic library (.so) linking several other libraries statically (.a archive)
Date: Mon, 14 Jan 2008 08:13:48 -0800 (PST)

Hi,

  I'm quite new to the autotools. I'm using them currently to build a huge
project composed of several pieces. In order to provide flexibility and also
a bit to understand how autotools work I have to admit, I chose to build
each part either as a dynamic library (.so file) or as static library (.a
archive). As I'm using libtool as well, these files are hidden behind
libtool .la output files.

  It works fine, that's not the issue. However, here it comes:

  In opposition to what I did for every pieces of the whole thing, I need
the final library to be dynamic (a .so file), but with all former pieces
inconditionnally statically linked inside it. In other words, I want to
produce a single big shared object with everything inside (besides standard
libraries however, but should be an issue I assume).

  I've read a lot of forum helps on the web providing libtool command lines,
like some promoting the use of -static option of libtool command. However,
I'm using a Makefile.am as a source and, of course, I want to stick to it.
I've already searched in the doc and the previous posts as well without
success.

  You might want to know what I've already tried:

1) Put .la files in the ultimateLibrary_la_LIBADD directive.

=> This caused the final .so file not to contain other project pieces inside
the library, but rather have a dynamic link to the piece shared libraries.

2) Put .a files in the ultimateLibrary_la_LIBADD directive.

  It works, but I'm warned of a non portability issue. (It does not work for
a static build)

3) Put .a files in the ultimateLibrary_la_LDADD directive.

=> Piece libraries are neither statically or dynamically linked against.

  I have to add that, while searching, I was alerted of a possible
compilation issue, as static archives are certainly not compiled in a PIC
fashion.

  Can you, please, provide a clear explanation on how to do this (including
the PIC issue), preferentially by providing a sticking-by-the-rule solution,
or otherwise at least by providing a Makefile.am solution that works no
matter how?

  I must write that I would be really astonished if it couldn't be done, as
I see .la files as a way for autotools to provide freedom to the developper
on the form of the final product he wants to get: .so or .a or maybe a mix
when necessary, as no-one can prejudge on the constraints a developper may
be under: like, for instance, having to provide a single file for production
release and still having a modular project structure splitted in several
sub-libraries (yes it's not a myth, it exists! ;-) ), which is, I think, a
very likely scenario.

  Thanks in advance.

--
Thibaud
-- 
View this message in context: 
http://www.nabble.com/Setup-automake-to-build-dynamic-library-%28.so%29-linking-several-other-libraries-statically-%28.a-archive%29-tp14804478p14804478.html
Sent from the Gnu - Automake - General mailing list archive at Nabble.com.





reply via email to

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