Boost logo

Boost-Build :

From: Ali Azarbayejani (ali_at_[hidden])
Date: 2003-03-28 11:02:43


In the current build system the "lib" target may be built "shared" or
"static". Note that a "shared" library is a loadable object like an
executable, while a "static" library (an "Archive") is not.

Shared libraries can either statically link their library dependencies
or pass them on to be linked later. David pointed out also that BBv2
is capable of defining a principled way of statically linking archives
into archives (actually just link in the objects of the archive...we
know where they are).

These options seem to open the door to some ambiguity about how to
build, link, and load chains of libraries. BBv2 should have some way
of expressing the desired scheme of linking and loading.

To be completely pedantic, the following recipe

lib a : $(ASrc) ;
lib b : $(BSrc) a ;
lib c : $(CSrc) b ;
exe d : $(DSrc) c ;

can, in theory, be built, linked, and loaded a number of ways.

With the following notation

<x> = archive with symbols from library "x"
<xy> = archive with symbols from library "x" and "y"
[x] = loadable module (exe or shared library) with symbols from "x"
[x<y>] = loadable module created by statically linking to archive <y>

the possible build products are

<a> [a]
<b> <ba> [b] [b<a>]
<c> <cb> <cba> [c] [c<b>] [c<b><a>] [c<ba>]
[d] [d<c>] [d<c><b>] [d<cb>] [d<c><b><a>] [d<cb>a] [dc<ba>] [d<cba>]

which includes all the possible linking schemes. This set of build
products results in the following combinations of loadable modules
that can be used to run executable "d".

[d] [c] [b] [a] * Normal "shared" linking scheme
[d] [c] [b<a>] - realistic
[d] [c<b>] [a] - realistic
[d] [c<b><a>] - realistic
[d] [c<ba>]
[d<c>] [b] [a] - realistic
[d<c>] [b<a>] - realistic
[d<c><b>] [a] - realistic
[d<cb>] [a]
[d<c><b><a>] * Normal "static" linking scheme
[d<cb><a>]
[d<c><ba>]
[d<cba>]

The normal "shared" scheme is currently implemented by propagating
<link>shared to all the library targets. The normal "static" scheme
is currently implemented by propagating <link>static.

The schemes labeled "realistic" involve "shared libs linked to
archives", and are realistic build scenarios that should be supported.
Does anyone have any thoughts on how these schemes are to be expressed
in BBv2?

The unmarked schemes contain "archives linked to archives", which,
outside of BBv2, would not normally be considered. So I don't care so
much about these, but it would be interesting to consider how these
might be expressed because they are somewhat of a parallel concept to
"shared lib linked to archive".

Thanks,
--Ali

 


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