Upon linking the boost 1.63.0 library libboost_regex-mt.a to a shared library I am getting the error:
/usr/bin/ld: /usr/local/lib/libboost_regex-mt.a(instances.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libboost_regex-mt.a: could not read symbols: Bad value I actually have compiled boost with -fPIC by using the following command (also see here):
./bjam '-sBUILD=<cxxflags>-fPIC <linkflags>-fPIC' --without-mpi --without-python --without-iostreams --layout=tagged link=shared,static When doing a bjam debug build, it seems that bjam only seems to honor the -fPIC for some source files, other files (including instances.cpp from the regex library) are compiled without it:
gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.8/release/link-static/threading-multi/instances.o "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -m64 -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/regex/build/gcc-4.8/release/link-static/threading-multi/instances.o" "libs/regex/build/../src/instances.cpp" How do I force bjam to use the -fPIC flag for all files?