Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-03-28 13:34:30


Mike wrote:

> Hello,
>
> I am attempting to build boost 1.34.1 on 64-bit Linux with bjam v2 passing
> the -fPIC compiler option along to gcc/g++. I would like to pass all
> necessary bjam parameters via the command line.
>
> After building bjam, I make the following call:
>
> bjam --v2 -d2 --toolset=gcc gcc/variant=release,debug gcc/cflags=-fPIC
> gcc/cxxflags=-fPIC gcc/linkflags=-fPIC --build-dir=<my builddir
> path> --prefix=<my install path> install
>
> The output from bjam shows that sources compiled for static linking do *not*
> have the -fPIC flag.

This is a bug in 1.34.1, it's fixed in upcoming 1.35.

> For example:
>
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread
> -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o "<my
> builddir>/release/link-static/threading-multi/execution_monitor.o"
> "libs/test/src/execution_monitor.cpp"
>
> This version of execution_monitor.o is put into the
> libboost_test_exec_monitor-gcc41-mt-1_34_1.a archive.
>
>
> Alternatively, sources that are pulled into a shared library have the -fPIC
> flag. For example:
>
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -fPIC
> -pthread -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_DYN_LINK=1 -DNDEBUG -I"." -c -o
> "<my builddir>/release/threading-multi/execution_monitor.o"
> "libs/test/src/execution_monitor.cpp"
>
> This version of execution_monitor.o is pulled into
> libboost_prg_exec_monitor-gcc41-mt-1_34_1.so.1.34.1
>
>
> Can anyone tell me why -fPIC is not passed to all calls of g++/gcc?
>
> I am also observing that the -fPIC flag is not passed to any link steps.

Should it, and if so, why?

- Volodya


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