_ROOT Version: v6.18/00
_Platform: Linux/Fedora30 x86_64
_Compiler: g++ (GCC) 8.3.0 (downgraded)
It’s high time and I’m trying to convert from python2 to py3…
On Fedora, py2 and py3 still coexist. (I’m willing to remove py2 if possible)
After building root w/ (python-related options only)
python OFF
python3 ON
PYTHON_EXECUTABLE /usr/bin/python3
PYTHON_INCLUDE_DIR /usr/include/python3.7m
PYTHON_LIBRARY /usr/lib64/libpython3.so
libPyROOT.so still uses libpython2.7.so.1.0.
[furutaka@Furutaka-3 lib]$ ldd libPyROOT.so|grep python
libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x000014b67304b000)
It seems to me that this cause the following error:
[furutaka@Furutaka-3 ~]$ python3
Python 3.7.3 (default, May 11 2019, 00:38:04)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/root/lib/ROOT.py", line 24, in <module>
import cppyy
File "/usr/local/root/lib/cppyy.py", line 61, in <module>
import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)
>>>
Renaming the py2.7 lib and cmake’ing from scratch yields the following error:
CMake Error at interpreter/llvm/src/CMakeLists.txt:613 (if):
if given arguments:
"VERSION_LESS" "2.7"
Unknown arguments specified
-- Configuring incomplete, errors occurred!
The corresponding part of the interpreter/llvm/src/CMakeLists.txt reads:
601 # Verify that we can find a Python 2 interpreter. Python 3 is unsupported.
602 # FIXME: We should support systems with only Python 3, but that requires work
603 # on LLDB.
604 set(Python_ADDITIONAL_VERSIONS 2.7)
605 include(FindPythonInterp)
606 if( NOT PYTHONINTERP_FOUND )
607 message(FATAL_ERROR
608 "Unable to find Python interpreter, required for builds and testing.
609
610 Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
611 endif()
612
613 if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
614 message(FATAL_ERROR "Python 2.7 or newer is required")
615 endif()
This way, it seems LLVM is forcing the use of py2.
What is the correct/proper way to build root with python3?
Thanks…
Kazuyoshi