Boost logo

Boost-Build :

From: Philipp Frauenfelder (pfrauenf_at_[hidden])
Date: 2004-07-06 04:27:13

[ I have not been able to search the list archives as Yahoo! is
temporarly refusing to create accounts. ]

Dear Jamboosters

I am using Boost.Build v2 in one of my own projects (switching
from ugly Makefile hacks which were terribly slow). It works
great and is much more powerful and faster than make with
respect to dependencies (implicit and explicit) without much
programming, great, thanks a lot! I want to use external
libraries in my project and have two questions regarding this. I
am using Debian GNU/Linux and I am a complete newbie in the Jam
/ Boost.Build world.

- Libraries (also the internal ones) are linked twice to my

This is my master Jamfile:
project concepts-2
: usage-requirements <include>.
: requirements <hardcode-dll-paths>true <variant>debug:<define>DEBUG
: build-dir builds ;

build-project basics ;

The Jamfile in basics looks like this:
project concepts-2/basics ;


lib libconceptsbasics : $(SOURCES) ;

And in basics/testsuite, I have some test programs for basics:
project concepts-2/basics/testsuite
: requirements <library>/concepts-2/basics//libconceptsbasics ;

unit-test debugTest : ;

When running 'bjam -d2' in basics/testsuite, is
compiled and linked. The compile step is ok, but the link step
looks like this:
----8<----8<----8<----8<----8<----8<----8<---- ../../builds/basics/testsuite/debugTest.test/gcc/debug/debugTest

g++ -g -Wl,-R -Wl,"/scratch/pfrauenf/concepts-jam/builds/basics/gcc/debug" -o "../../builds/basics/testsuite/debugTest.test/gcc/debug/debugTest" "../../builds/basics/testsuite/debugTest.test/gcc/debug/debugTest.o" "../../builds/basics/gcc/debug/" -Wl,-Bdynamic -Wl,-Bstatic "../../builds/basics/gcc/debug/" -Wl,-Bdynamic -Wl,-Bstatic -Wl,-Bdynamic
ie. the library defined in basics is linked twice. At this
stage, it does not do any harm. But I have a external (binary)
library which I would like to include as well. It is also
linked twice to my executables and the linker complains about
all symbols in the external library to be defined twice.

How can I have the linking just once?

- I would like to have one file where all external libraries are
declared. On some other systems, not all libraries are
installed and I would like to have a configuration option in
this same file which can be evaluated in the Jamfiles for
conditional compiles. I guess the file site-config.jam is
intended for this. Most of the stuff, I got to work, but I
think it is a little bit ugly.

This is my site-config.jam:
import project ;
project.initialize $(__name__) ;
project site-config ;

lib libfl : : <name>fl ;

rule HAS_PARDISO { return true ; }
lib pardiso : : <name>pardiso32
<search>/scratch/pfrauenf/pardiso_example :
: <include>/scratch/pfrauenf/pardiso_example <define>HAS_PARDISO ;

The libfl is no problem, it is installed everywhere (and I do
not intend to have a conditional compile on it. But I would
like to have a conditional compile with pardiso. The above
works if I use the following code in a Jamfile in a source
import site-config ;

if [ site-config.HAS_PARDISO ] = true {
obj pardiso : : : <use>/site-config//pardiso ;
SOURCES += pardiso ;
LIBS += <library>/site-config//pardiso ;
However, I suspect there is a simpler way to achieve this.
Could you give me a hint, please?

Thanks a lot in advance.


Philipp | work: pfrauenf_at_[hidden] +41 44 632 60 38
Frauenfelder | home: pfrauenf_at_[hidden] +41 44 862 73 14
[PGP] |
Proudly running Debian GNU/Linux. See

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at