Hello Everyone,
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. 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.
Aside: I have already tried to use the bjam v1 syntax to override the gcc/g++ calls, but it seems as though bjam v1 cannot be invoked.
Thanks,
Mike