From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-01-20 07:33:34
> If you create a library from object files (that are listed in the
> Jamfile explicitly), the -fPIC flag is not used when compiling a shared
> library (I'm using the gcc toolset)
> The solution I see is adding following to gcc.jam
> if [ os.name ] != CYGWIN && [ os.name ] != NT
> flags gcc.compile OPTIONS <link>shared/<main-target-type>LIB : -fPIC ;
> + flags gcc.compile OPTIONS <link>shared/<main-target-type>OBJ : -fPIC ;
> Can anybody tell me if this is indeed the way to go?
Looks like a reasonable solution for me. The downside is that now all targets
defined with "obj" will be compiled with -fPIC, not only when they are part
of a shared library.
This can be avoided by using some new <shared-linkable> property but target
paths will become even longer. When I introduce automatic computation if
properties relevant to a target, this might not be a problem, but until now,
the above code seems the most reasonable.
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