Root install on ubuntu 22.04

Hello,
I’m trying to install root on my ubuntu system and this error popped up while installing from source code using “cmake --build . --target install -j6” ;

Scanning dependencies of target G__ROOTGpadv7
[ 79%] Building CXX object graf2d/gpadv7/CMakeFiles/G__ROOTGpadv7.dir/G__ROOTGpadv7.cxx.o
[ 79%] Built target G__RooFitJSONInterface
[ 79%] Building CXX object roofit/jsoninterface/CMakeFiles/RooFitJSONInterface.dir/src/JSONInterface.cxx.o
[ 79%] Built target G__ROOTTPython
[ 79%] Building CXX object roofit/jsoninterface/CMakeFiles/RooFitJSONInterface.dir/src/JSONParser.cxx.o
[ 79%] Built target G__XMLIO
[ 79%] Building CXX object bindings/tpython/CMakeFiles/ROOTTPython.dir/src/TPyArg.cxx.o
[ 79%] Building CXX object bindings/tpython/CMakeFiles/ROOTTPython.dir/src/TPyClassGenerator.cxx.o
[ 79%] Building CXX object bindings/tpython/CMakeFiles/ROOTTPython.dir/src/TPyReturn.cxx.o
[ 80%] Building CXX object bindings/tpython/CMakeFiles/ROOTTPython.dir/src/TPython.cxx.o
[ 80%] Built target G__ROOTVecOps
[ 80%] Building CXX object math/vecops/CMakeFiles/ROOTVecOps.dir/src/RVec.cxx.o
[ 80%] Building CXX object io/xml/CMakeFiles/XMLIO.dir/src/TBufferXML.cxx.o
[ 80%] Built target G__Net
[ 80%] Building CXX object io/xml/CMakeFiles/XMLIO.dir/src/TKeyXML.cxx.o
[ 80%] Linking CXX shared library ../../lib/libROOTTPython.so
/usr/bin/ld: /usr/local/lib/libpython3.11.a(pythonrun.o): warning: relocation against `_Py_UnhandledKeyboardInterrupt' in read-only section `.text.unlikely'
/usr/bin/ld: /usr/local/lib/libpython3.11.a(abstract.o): relocation R_X86_64_PC32 against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [bindings/tpython/CMakeFiles/ROOTTPython.dir/build.make:151: lib/libROOTTPython.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:42486: bindings/tpython/CMakeFiles/ROOTTPython.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 80%] Building CXX object io/xml/CMakeFiles/XMLIO.dir/src/TXMLEngine.cxx.o
[ 80%] Building CXX object io/xml/CMakeFiles/XMLIO.dir/src/TXMLFile.cxx.o
[ 80%] Building CXX object io/xml/CMakeFiles/XMLIO.dir/src/TXMLPlayer.cxx.o
[ 80%] Building CXX object io/xml/CMakeFiles/XMLIO.dir/src/TXMLSetup.cxx.o
[ 80%] Linking CXX shared library ../../lib/libRooFitJSONInterface.so
[ 80%] Built target RooFitJSONInterface
[ 80%] Linking CXX shared library ../../lib/libXMLIO.so
[ 80%] Built target XMLIO
[ 80%] Built target G__ROOTGpadv7
[ 80%] Linking CXX shared library ../../lib/libROOTVecOps.so
[ 80%] Built target ROOTVecOps
gmake: *** [Makefile:156: all] Error 2

_ROOT Version: ROOT-6.28.04
Platform: Ubuntu 22.04 LTS
Compiler: CMAKE 3.22.1 // GCC/G++ 11.3.0


Hi @Jyoti_Prakash_Behera,

welcome to the forum! It is most likely a problem with your specific setup and previous installations of other packages. You’re getting a linking error, you’ll probably need to fix this: “relocation R_X86_64_PC32 against symbol `_Py_NotImplementedStruct’ can not be used when making a shared object; recompile with -fPIC”.

Having said that though, is there a particular reason why you want to build ROOT yourself? We generally recommend installation via a package manager, anaconda, or by downloading a binary release, see

Cheers,
Marta

Hello Marta,
I have a project which involves running simulations on GATE and I looked up some tutorials online which mentioned installing root from the source file. Can you please elaborate what packages these could be that are creating the problem?

Thanks

Hi @Jyoti_Prakash_Behera,

these lines say that the python shared library cannot be linked:

[ 80%] Linking CXX shared library ../../lib/libROOTTPython.so
/usr/bin/ld: /usr/local/lib/libpython3.11.a(pythonrun.o): warning: relocation against `_Py_UnhandledKeyboardInterrupt' in read-only section `.text.unlikely'
/usr/bin/ld: /usr/local/lib/libpython3.11.a(abstract.o): relocation R_X86_64_PC32 against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [bindings/tpython/CMakeFiles/ROOTTPython.dir/build.make:151: lib/libROOTTPython.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:42486: bindings/tpython/CMakeFiles/ROOTTPython.dir/all] Error 2

but maybe @vpadulan could take a quick look at this?

Cheers,
Marta

Dear @Jyoti_Prakash_Behera ,

First off, the usual question. Do you really need to build ROOT from source?

Then, back to your original post, you haven’t told us what cmake configuration you are using. Could you write the cmake command? e.g. cmake [OPTIONS] -B build_dir -S root_source_dir ?

Cheers,
Vincenzo

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