Compilation error (relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used)

_Hi!
I am trying to install root-6.26.10 on Ubuntu 22.04 and, when I run the “make” command, at 97%, I keep getting this error:
[ 97%] Linking CXX shared library …/…/lib/libROOTTPython.so
/usr/bin/ld: /usr/local/lib/libpython3.10.a(pythonrun.o): warning: relocation against _Py_UnhandledKeyboardInterrupt' in read-only section .text’
/usr/bin/ld: /usr/local/lib/libpython3.10.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct’ 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
make[2]: *** [bindings/tpython/CMakeFiles/ROOTTPython.dir/build.make:151: lib/libROOTTPython.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:34934: bindings/tpython/CMakeFiles/ROOTTPython.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Does anyone know what is causing the error or how can I fix it?

Thank you very much!

It seems you only have the static “libpython3.10.a” library, but you actually need the shared (“libpython3.10.so”) one. Talk to the one who installed it in the “/usr/local/lib” directory.

Thanks!

Also, please take a look at the Install instructions on the ROOT website. Building ROOT from sources is something we discourage for regular users unless justified otherwise.

That said, the preferred method of installing ROOT is via a binary package for your distribution or via a Conda package. That should save you some headaches (unless you have a very strong reason to build ROOT from sources…).

Cheers,
J.