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?

Environment where the error occurs:

Linux tudoposso-virtual-machine 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

PS.: line 5 and 6 always gives error.

Thank you
Paulo Marcio



On Wed, Feb 12, 2014 at 6:45 PM, Thomas Suckow <thomas.suckow@pnnl.gov> wrote:
On 02/12/2014 12:34 PM, Paulo Márcio Figueiredo Alves wrote:
I want to link statically with boost libraries.



Take a look at http://www.boost.org/boost-build2/doc/html/bbv2/tutorial/linkage.html


I believe what you want to do is force your library to be shared:
lib l : l.cpp : <link>shared ;

And when you use boost, force it to be static:
lib l : l.cpp /boost//thread/<link>static : <link>shared ;

Boost-build should then do the right thing I believe.

--
Thomas

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build