Boost logo

Boost-Build :

Subject: Re: [Boost-build] [EXTERNAL] cflags not being inherited
From: Thomas Suckow (thomas.suckow_at_[hidden])
Date: 2014-02-19 17:59:12


On 02/19/2014 11:33 AM, Paulo Márcio Figueiredo Alves wrote:
> I have made a simple test to show the problem (attached file). If you do
> not use Boost.Thread, the problem does not occur.
> Adjust boost path (line 1) and call b2 -a, you'll see "recompile with
> -fPIC". Choose one of the commented choices
> for target foo_static and you will see that there is no way to make it
> work, unless you call b2 -a cxxflags=-fPIC.
>
> Is it a bug? Is there any workaround? Am I doing something wrong?

It would appear that the override of <link>static is preventing
boost-build from knowing it needs to use -fPIC.

That said, it bugs me thinking that the boost libraries are being linked
into more than one of your shared libraries.

In your library, since random is header-only, I would use:
: <use>/boost//headers <implicit-dependency>/boost//headers ;
AFAIK, this is the most correct syntax. I've been trying to figure out
the best syntax since modular-boost changes some things.

This is the best I could come up with:
lib foo_static : foo_static.cc : <link>static <cxxflags>-fPIC
<use>/boost//headers <implicit-dependency>/boost//headers ;

lib foo_shared : foo_shared.cc foo_static : <link>shared : :
<library>/boost//thread/<link>static ;

exe foo : foo.cc foo_shared : <threading>multi ;

I am kind of disappointed in this solution :-/

-
Thomas


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