ROOT Version: 6-20-04 Platform: Scientific Linux 6.10 x86_64 Compiler: gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3) Python: Python 3.5.7
I am trying to compile ROOT in a cluster computing server where I have no root access (pun not intended).
I already succeeded in compiling ROOT without Python support but now I need it so I am recompiling.
There is an error during the CMake configuration step that I was not able to solve. It might even be a bug but I still do not know for sure.
I have compiled Python 3 from source and it is working fine (tested). So now I would like to point ROOT to this custom Python installation.
I have already made sure that the python command redirects to the custom python
$ python --version
$ which python
Moreover, I am passing all the relevant options to CMake
-- Enabled support for: asimage builtin_afterimage builtin_clang builtin_ftgl builtin_gl2ps builtin_glew builtin_llvm builtin_lz4 builtin_lzma builtin_pcre builtin_tbb builtin_vdt builtin_xrootd builtin_xxhash builtin_zstd clad dataframe exceptions fftw3 fortran gdml http imt mathmore mlp minuit2 mysql opengl pgsql python roofit runtime_cxxmodules shared ssl tmva tmva-cpu spectrum vdt x11 xml xrootd
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
used as include directory in directory /home/nu/giorgio/ROOT/sources/bindings/pyroot
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
This has been removed a long time ago. Please use only -Dpython=ON when configuring, although that is already the default (in current master that is now called -Dpyroot=ON though). Also, you might have better luck with -DCMAKE_PREFIX_PATH=$HOME/python-3.5.7 instead of setting other variables. It’s also recommended to only set PYTHON_EXECUTABLE and leave the library and include paths for CMake to figure out. Another thing is that you are trying to use a static library for python and that likely won’t work with ROOT. You need to recompile your Python with --enable-shared or similar to use it with ROOT. You should make sure to use the same GCC for ROOT and your custom Python as well, just in case.
BTW, if you have no network, you should add -Dimt=OFF, otherwise ROOT will try to download TBB by default. Same for the xrootd option (which may require network to download the bultin xrootd).
I have recompiled Python enabling the shared libraries and that did the trick.
To be a little more future-proof, this time I have chosen Python 3.8.2 because Python 3.5 is close to EOL.
I can now build PyROOT in both the branches v6-20-00-patches and v6-20-04. By the way, is there any reason to prefer v6-20-00-patches over v6-20-04?
Just as @amadio suggested, I have only specified the PYTHON_EXECUTABLE and let cmake figure out the rest. Thank you very much for your help.
Not sure, but libraries with no sources were a problem in older versions of CMake. Maybe you need to use external VDT if you use builtin_vdt. But just disabling it will probably cause no harm to you if you’re not using it directly.