[Top][All Lists]

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

Using libtool to package whole archives in shared library

From: Andy Falanga (afalanga)
Subject: Using libtool to package whole archives in shared library
Date: Wed, 4 Mar 2015 22:43:19 +0000

I'm working on converting a home-grown makefile mess to using the autotools 
(the GNU build system) for building and deploying our shared library.  The 
shared library exists in two forms: a traditional C++ *.so and a python module 
which is also a *.so but is, obviously, consumable by python only.  The 
directory structure looks like this:

Main  (has a and files)
  |    |
  |    |- HwMgmt  (, makes libhwmgmt.a and
  |    |- Misc    (, likewise for libmisc)
  |-sata  (, produces and
  |   |
  |   |-satacpp   (sources for the C++ API for SATA lib)
  |   |
  |   |-sata      (sources wrapping satacpp,hwmgmt,misc in boost.python)

In our home-grown system, we build HwMgmt, Misc and satacpp into *.a files and 
then, when building for python these *.a files were wrapped between 
-Wl,--whole-archive ... -Wl,--no-whole-archive.  I've got to replicate this 
into the GNU Build System.  I've tried several attempts and nothing has yet 
worked.  Using the GNU docs, I've placed these libraries using

 sata_la_LIBADD = /path/to/ /path/to/ ...

Which links with the dynamic libraries built earlier.  This isn't what I'm 
after.  I've tried something like this:

 sata_la_LDFLAGS = -Wl,--whole-archive /path/to/libsatacpp.a ... 

This variable is preserved throughout and Makefile.  However, when 
make is run, it seems that libtool yanks the libraries between --whole-archive 
and --no-whole-archive and places them elsewhere.  That is, I always ended with 
"-Wl,--whole-archive   -Wl,--no-whole-archive" with my *.a file unceremoniously 
moved to a different place in the command line.

What is the proper way to tell libtool to wrap the entire batch of symbols into 
the final python library?

I'm using CentOS 6 which, sadly, prefers to be older than the hills in its 
toolset.  The versions are as follows:
        autoconf: 2.63  (I think I recently updated this for something 
        automake: 1.11.1
        libtool: 2.2.6b  (This one appears to be woefully old)


reply via email to

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