Recompile with -fPIC OR libpython3.6m.a', needed by `lib/libPyROOT.so'


_ROOT Version: 6.14.02
Platform: Scientific Linux release 7.5 (Nitrogen)
Compiler: gcc (GCC) 4.8.5 20150623


root_build> cmake -DCMAKE_INSTALL_PREFIX=~/root_bin -Dpython_version=3 -DPYTHON_EXECUTABLE=~/python363-GCC-4.8.5/bin/python3 -Droofit=OFF -Dtmva=OFF -Dpythia8=OFF ~/root-6.14.02_source/

python was compile from sources with
./configure --prefix=~/python363-GCC-4.8.5 --enable-shared

Why am I using --enable-shared? because of a previous error
98%] Linking CXX shared library …/…/lib/libPyROOT.so
/bin/ld: /python363-GCC-4.8.5/lib/libpython3.6m.a(myreadline.o): relocation R_X86_64_32 against `.rodata.str1.1’ can not be used when making a shared object; recompile with -fPIC

How do I go on with this?

Thanks for helping
Roberto

it turns out I need to tell explicitely where the .so is located, although it’s just in its standard location given my executable. This is done using PYTHON_LIBRARY=~/python363-GCC-4.8.5/lib/libpython3.6m.so

The problem is that you are trying to link a shared library against a statically compiled Python, but the static library from Python is not position independent. To link code into a shared library, it needs to be compiled with -fPIC, so you need to recompile Python with -fPIC to be able to link it into libPyROOT.so.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.