Boost logo

Boost-Build :

Subject: [Boost-build] linking a library from static libraries
From: Paul Fox (techmage89_at_[hidden])
Date: 2009-06-04 01:21:02


I am working on the build system for a fairly large project, which will
produce a static and a shared-object version of a library. In order to keep
the project manageable, it has been divided into several modules.
Each module is currently building as a static library, and the Jamroot for
the project lists all of the applicable sub-projects as dependencies.
However, I found that it was in fact building an empty library, both in
static and dynamic mode!

Doing some poking around, I discovered that for the static build, it was not
passing ar the static libraries at all, instead only giving it one system
shared library to link against. I also discovered that in dynamic mode, it
was giving ld the appropriate list of libraries, but ld was ignoring them.

Upon further investigation, I discovered that neither ar nor ld will accept
static (.a) libraries as arguments to build a library by default. ar expects
object files, which would require the relevant .a files to be unpacked, and
ld will only include .a files in a dynamic library if you use the
--whole-archive flag preceding the list, and the --no-whole-archive flag
following it.

I therefore currently have to execute the last linking step manually after
boost-build executes, which is far from ideal. What would be the best way to
handle this in boost-build? Is there another way I can type the modules so
that they will return a bunch of object files instead of a library? Is there
a way to make boost-build aware of how to create a library from a library?
What is the cleanest solution?

Thank you in advance for your help



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk