Hi All,
I am trying to statically link a shared library I am developing with the
Boost Regex library. I get the following error:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
/usr/lib64/libboost_regex.a(instances.o): relocation R_X86_64_32 against
`boost::object_cache ::do_get(boost::re_detail::cpp_regex_traits_base<char> const&, unsigned
long)::s_data' can not be used when making a shared object; recompile
with -fPIC I have run across this once before, and although I am not really clear
why, it appears that on my AMD64 platform, if I try to link a static
library into a shared library, that static library needs to be compiled
with -fPIC (this requirement does not exist for normal x86 platforms).
My question is: is there an already available option that I can add when
compiling the Boost libraries to enable this setting? I am not at all
familiar with the BJam build system.
Thanks for any assistance!
Best,
Scott
Scott Amort wrote:
My question is: is there an already available option that I can add when compiling the Boost libraries to enable this setting? I am not at all familiar with the BJam build system.
cd boost-root/libs/regex/build bjam -sBUILD="<cxxflags>-fPIC" stage Or you could hack one of the provided makefiles in libs/regex/build to do this quite easily. John.
John Maddock wrote:
cd boost-root/libs/regex/build bjam -sBUILD="<cxxflags>-fPIC" stage
Or you could hack one of the provided makefiles in libs/regex/build to do this quite easily.
If you are using g++, you should be able to use -sBUILD="<shared-linkable>true" (plus any other options you want). It works with Boost 1.33.0, and I assume it will still exist in later versions. -- Dick Hadsell 914-259-6320 Fax: 914-259-6499 Reply-to: hadsell@blueskystudios.com Blue Sky Studios http://www.blueskystudios.com 44 South Broadway, White Plains, NY 10601
participants (3)
-
John Maddock
-
Richard Hadsell
-
Scott Amort