Boost logo

Boost-Build :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2004-04-27 21:33:28


Toon Knapen wrote:

> I have a dynamic library 'bar' that calls MPI routines (or whatever
> third party library) that are defined in a static library. Now my
> executable 'foo' calls a function defined in 'bar' and also calls MPI
> functions.
>
> foo.exe ----calls----> bar.so ----calls-----> MPI (mpich.a, pmpich.a)
> | ^
> |---------------------------------------------
>
>
> Now when I ask bjam to link my executable (see Jamfile, foo.cpp and
> bar.cpp in attachment), the static MPI library shows up in front of the
> (dynamic) library 'bar':

[snip]

> Now I know that the order of the libraries for static libraries matters
> and does not matter for shared libraries. However I'm not sure if the
> order matters for a mix of static and shared libraries. But if I put the
> (static) mpi library after 'bar' it links fine, if not, I have
> undefineds in 'bar'.
>
> So my question now is, should'nt libraries added in the requirements
> section not always appear after the libraries in the source section of
> the target description. The requirements section generally refers to
> libraries from the system whereas the source-section refers to libraries
> in your project which are possibly dependent on the system libraries.

I'm not sure that's a convincing argument. And I'm sure that one could
come up with arguments to do it both ways. At the end it comes down to
needing control in ordering the library usage. Which is something BBv2
has some support for.

> (I hope I succeeding in communicating this thing clearly, I tried to
> explain this as good as I can)

Not totally clear but I know the general problem :-)

In your small example I do have a question... Why do you add the MPI
dependency to the foo.exe instead of adding it to the bar.so, which is
the one that has the real requirement? Doing that instead would solve
the link order problem in this case.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
 

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