Boost logo

Boost-Build :

Subject: Re: [Boost-build] building boost static libraries with position independent code
From: Ben Pope (benpope81_at_[hidden])
Date: 2016-08-25 08:26:21


On Thursday, August 25, 2016 04:19 PM, Peter Steinbach wrote:
> Hi to all,
>
> I'd like to use boost in a project where I need to interface to java
> (JNA). For this, only DLLs or shared libraries are possible to use. In
> order to use boost in my cmake based cross-platform project, I'd would
> like to link against the static boost libraries. I failed to do so yet
> as they are default build *without* position independent code (checked
> with 1.59.0). I found a very old entry in the archives of this list
> regarding this issue:
> http://lists.boost.org/boost-build/2007/06/16764.php
>
> Has this been solved by now? If so, what switch do I need to turn when
> invoking b2 to achieve the above?
>
> Any pointer to docs or the web are very welcome.
> Best,
> Peter

I have a ~/user_config.jam with something like this line (bits have been
redacted):

using gcc : 5~pic : g++ : <cxxflags>"-fPIC" <linkflags>"-pie" ;

The command line syntax may be different, but you can invoke the command
line, I think, with:

b2 toolset=gcc-5~pic ...

So perhaps:

b2 cxxflags=fPIC linkflags=-pie ...

For all I know there might be a feature for position independent code
now, which would make the syntax more convenient.

Steven Watanabe will be along shortly with the correct answer, I suspect.

Ben


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