From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-02-21 01:31:51
> Now I have more questions; hope you would not mind.
Surely not! You're welcome.
> The real problem for me at the moment is how to link one dll to
> For example I am using Xerces-C library, since CygWin comes with
> prebuilt xerces I decided to give it a try. In my Jamfile I put
> something like this:
> lib xerces : : <name>xerces-c22 <search>/lib ;
> lib util : util.cpp xerces ;
> And bjam does not even try to link it with xerces. It is not
> surprising that I am getting lots of link errors.
> If in my jamfile, I replace "lib util" with "exe util" it does link
> with xerces!
This is a bug Boost.Build
1) Fails to make any use of 'xerces' and
2) Fails to report the failure
This functionality was never tested, for a simple reason: I don't use it yet.
What I do is
lib test_lib : : <name>test_lib <search>../../lib ;
lib a : a.cpp : : : <library>test_lib ;
Here, <library>test_lib is "usage-requirements". They specify that whenever
'a' library is used, test_lib must be used (i.e. linked too). I think this is
a better approach in general, but anyway, the problem you've reported must be
> Another strange thing I notices is that link options appear twice on
> gcc command line, e.g.:
> g++ -g -L/lib -o bin/gcc/debug/util.exe
> bin/gcc/debug/util.o -Wl,-Bdynamic -lxerces-c22
> -Wl,-Bstatic -Wl,-Bdynamic -lxerces-c22 -Wl,-Bstatic -Wl,-
This strange thing was inherited from V1. gcc is sensitive to the library
order by default, and documentation warns that order-insensive mode is slow.
For that reason V1 and V2 just repeat all libraries twice, in hope that it
will work. It does not, and we should work the list of libraries passed to
the linker using dependencies between them. Alas, noone is in position to
implement this right away.
> And while we are at it, how would you suggest to tackle the problem
> that the same external library on different systems could be located
> in different places? Using environment variables?
This is one approach. Ultimately, the best solution would be to declare
targets in site-config.jam. On one system, it will contain:
lib xerces : : <name>xerces-c22 <search>/lib ;
and on another
lib xerces : : <name>xerces-c22 <search>/usr/lib ;
But we can't declare targets in site-config.jam yet. Such a desire occured
already (in context of Qt support and STLport support), so it might be
addressed relatively soon.
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