Boost logo

Boost-Build :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2005-01-16 14:09:09


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)

I have attached a small test-case that shows the problem. My Jamfile
looks like

<quote>
object bar_object : bar.cpp ;
lib libbar : bar_object ;

lib libfoo : foo.cpp ;
</quote>

When compiling the intermediate foo.o object-file, the -fPIC flag is
used when creating a shared libfoo library. When creating a shared
libbar library however, the -fPIC flag is not used when compiling the
bar.o object file '-(

The solution I see is adding following to gcc.jam
<quote>
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 ;
}
</quote>

Can anybody tell me if this is indeed the way to go?
 --------------060801080008060008080802 Content-Type: application/octet-stream;
name="bjam_pic_problem.tar"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="bjam_pic_problem.tar"

[Attachment content not displayed.] --------------060801080008060008080802--


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