[C++-sig] R_X86_64_PC32 error and -fPIC
Simon Pickles
sipickles at hotmail.com
Sat Aug 16 16:10:01 CEST 2008
sorry, that s
Simon Pickles wrote:
> Hi
>
> I hope this is on topic. It may be a gcc problem, but its certainly
> caused by using bjam to link a c++ lib for boost::python. I should
> point out this whole area is new to me!
>
> Here's my error:
>
> ...updating 1 target...
> gcc.link.dll HybridBulletObject.so
> /usr/bin/ld: HybridModule.o: relocation R_X86_64_PC32 against
> `(anonymous
> namespace)::CHybridBulletObject::Init(boost::shared_ptr<CLog>,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> const&, unsigned int const&, float const&, float const&, float const&,
> float const&, float const&, float const&)' can not be used when making
> a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
>
>
> Compile what with -fPIC? I have an AMD64 (ubuntu 8.04) system. I
> thought only shared libraries needed to be compiled with PIC, and I am
> only linking to static libraries in HybridBulletObject.so.
>
> So, assuming its talking about the shared library output by bjam, I
> tried modifying my user-config.jam to:
>
> using gcc : : : <linkflags>-fPIC ;
> using python : 2.5 : /usr/local ; #stackless python location
sorry, should have been:
using gcc : : : <cxxflags>-fPIC ;
using python : 2.5 : /usr/local ;
Now, I can see -fPIC on the g++ compile command line. No effect on the
error tho.
Do I need to rebuild all my static libs with -fPIC too?
I notice that the boost python module will compile and link if I only
add const functions. Add a normal function and it baulks. Weird.
Simon
More information about the Cplusplus-sig
mailing list