By default, libboostpython.a
is compiled without -fPIC
. But I have to make a python extension and it is a dynamic library with -fPIC
that links to static libraries.
How can I compile a static library (libboostpython.a
) with -fPIC
from boost.python
?
There are a couple options you could use:
bjam ... cxxflags='-fPIC'
. That would compile every boost source file as position independent code.'-Wl,-rpath,$ORIGIN'
flag, so that when the dynamic linker searches for shared libraries required by your executable it looks for them in the directory where the executable is. See man ld.so for more details on $ORIGIN
.