Compiling error: relocation R_X86_64_32
Closed this issue · 3 comments
When building Boost.NumPy using CMake, I get the following compiling error when running the make command:
Linking CXX shared library ../../../lib/libboost_numpy.so
/usr/bin/ld: /hpc/sw/python-2.7.5/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/hpc/sw/python-2.7.5/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libboost_numpy.so] Error 1
make[1]: *** [libs/numpy/src/CMakeFiles/boost_numpy.dir/all] Error 2
make: *** [all] Error 2
This is after creating a build directory and running cmake.
This means that there are some static libraries which have to be recompiled into dynamic ones. How should I proceed?
I'm guessing (just from the fact that I see libpython2.7.a
, not libpython2.7.so
) you just don't have a shared-library version of Python installed. Most OSs and metapackages that ship Python build the shared library by default, but my recollection is that if you build Python from source you have to explicitly ask for the shared library.
Something was indeed wrong with the shared library. Since I ran on a computer where I had no admin rights whatsoever, I sadly cannot tell why it does work now. I just restarted everyting and loaded the desired python (Python 2.7.9), after which the make command functioned as it should.
Glad you got it working. I'm closing this issue now; please feel free to reopen if necessary.