|
Boost-Build : |
From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2004-08-31 07:54:55
First of all: thanks for the great bjamv2 system. In two weeks I managed
to convert 5 projects with a total of 100K lines to the bjamv2 build
system on multiple platforms. There are still some quirks but most of it
is operational.
One of those quirks however is very interesting: I have an exe which
contains an embedded python interpreter. Next I also build python
extensions modules with bjam. When I 'import' these extensions into
python, these dynamic libraries need to find symbols defined into the
executable. This can be done using the --export-dynamic flag when using
the gnu linker. But of course, when I link my application, it does not
know yet that some symbols will be used later on by libraries that are
dynamically linked in (using dlopen via the python 'import' command). So
these symbols are eliminated because they are dead-code. So to suppress
dead-code elimnation, I need to specify the flag --whole-archive to the
linker. Now the linker will link in the whole archives that follow the
'--whole-archive' flag. But gcc and bjam additional libraries to the end
of the link-line. However not the whole of these libraries should be
linked in. So this can be done with the flag '--no-whole-archive'.
So currently my Jamfile looks like :
lib system_lib : : <search>/usr/lib ;
lib my_lib : my_source.cpp ;
exe my_app : main.cpp my_lib :
<toolset>gcc:<linkflags>-Wl,--export-dynamic,--whole-archive ;
and produces following command-line
gcc --Wl,--export-dynamic,--whole-archive -L/usr/lib -o my_app main.o
my_lib.a -lsystem_lib ;
And no I would like to add the flag -Wl,--no-whole-archive just in front
of '-lsystem_lib' because for these system libs this flag can not be
specified.
The only option I see is to add '-Wl,--no-whole-archive' always in front
of the system libs in boost/tools/build/v2/tools/gcc.jam or is there
some other way ?
toon
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