From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-12-02 03:12:32
On Wednesday 01 December 2004 14:50, Toon Knapen wrote:
> Vladimir Prus wrote:
> > lib all-the-sources : .......... : <link>static <parallelism>none ;
> > lib your_lib : all-the-sources ;
> > would work. The idea is that you create auxilliary static lib, which will
> > be linked with <parallelism>none (so no duplication of objects), and then
> > your top-level link with use it. The top-level link can be built with
> > with real and fake mpi.
> Clever !!!!
> However, the objects inside the 'all-the-sources' library are generated
> without '-fPIC'. So it is dangerous to include this library in the
> shared library 'your_lib', no ?
No, it just prevent physical sharing of the library. That's bad too, but for
now I don't have any better solution than
I'll work out something but in the meantime you can use this. Interestingly,
right at the moment the same question (bulding static library with -fPIC) is
raised on scons-users mailing list.
> Next I modified my Jamfile(see attachment) as you propose above, however
> running 'bjam link=static' results in following error (see attachment)
Oh, so you're using static link too. You make a very good Boost.Build
The error is emitted because archiving-generator is given only LIB sources.
This raises another question. For static linking, it's not possible to link
one library into another.
Typically, Boost.Build works around this by making "lib" return both the
created static lib target and static lib targets that were passed by the
But I presume that in your case your_lib must be standalone. In fact,
"all-the-sources" is artificial device. This means you can do either:
- roll a handwritten loop as I've outlined previously
- take the 'convert.jam' file from the attached archive, add "import convert ;
" somewhere in your project and then use:
lib your_lib : objects ;
convert objects obj : a.cpp b.cpp ;
I attach a fully working setup, that I've tested with
(the a.cpp and b.cpp files are compiled with multithreading both times).
The convert.jam is part of my project and will be added to V2 eventually, just
--Boundary-00=_w5srBPjznIbIXcg Content-Type: application/x-tgz;
[Attachment content not displayed.] --Boundary-00=_w5srBPjznIbIXcg--
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