[C++-sig] R_X86_64_PC32 error and -fPIC

Simon Pickles sipickles at hotmail.com
Sat Aug 16 15:35:40 CEST 2008


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


but I can't see the -fPIC added to the command line produce by bjam:

    "g++"    -o "HybridBulletObject.so" -Wl,-h -Wl,HybridBulletObject.so 
-shared -Wl,--start-group "HybridModule.o" "HybridBulletObject.o" 
"Log.o" 
"/home/simon/Source/bullet-2.70/out/linux/optimize/libs/libbulletdynamics.a" 
"/home/simon/Source/boost_1_35_0/bin.v2/libs/python/build/gcc-4.2.3/debug/libboost_python-gcc42-d-1_35.so.1.35.0"  
-Wl,-Bstatic  -Wl,-Bdynamic -lutil -lpthread -ldl -Wl,--end-group -g

...failed gcc.link.dll HybridBulletObject.so...
...failed updating 1 target...

Thanks

Simon

-- 
Linux User# 424693 







More information about the Cplusplus-sig mailing list