I’m trying to compile ROOT in the following environment and I get the error message while running cmake:
-- Looking for python
CMake Error at cmake/modules/SearchInstalledSoftware.cmake:444 (message):
Version mismatch between Python interpreter (2.7.10) and libraries
(2.7.16).
ROOT cannot work with this configuration. Please specify only
PYTHON_EXECUTABLE to CMake with an absolute path to ensure matching
versions are found.
Call Stack (most recent call first):
CMakeLists.txt:159 (include)
I didn’t install any special python version. I’ve always simply used the one that comes with the OS.
Moreover, looking at the CMakeFiles/CMakeError.log:
That would work on Linux if python was build with enable-shared. Doesn’t fly on Mac. You’ll get an abort, claiming the interpreter was not initialized (b/c you’ll have two interpreter instances).
Somehow, it seemts to works for me on Mac … maybe because the difference is minor (2.7.10 vs 2.7.16). Note: this is a workaround. We obviously need to understand and correct it ‘the right way’ …(@etejedor could you help?)
Hi guys,
many thanks for the patch.
I’m not an expert, so what I did is to copy what you wrote in the file python.patch file and run the command: patch -p0 < python.patch
I get the error message:
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake
|index ed06b5d3ad..6181407464 100644
|--- a/cmake/modules/SearchInstalledSoftware.cmake
|+++ b/cmake/modules/SearchInstalledSoftware.cmake
--------------------------
File to patch:
try patch -p1 and/or answer the question with:cmake/modules/SearchInstalledSoftware.cmake
Note you need to be in the top directory of the source repository.
You are probably missing the headers for the Python version you are trying to use. I added this version check to ensure the Python interpreter and its library and headers match, so I really do not recommend the “solution” proposed above. If you hit an error due to this check, it’s because something is wrong with the configuration, that is, you are configuring with one Python version, but will link with the libraries for another version. Please inspect the value of ${PYTHON_INCLUDE_DIRS} and ${PYTHON_LIBRARIES} you get after configuration. If you mix different versions of Python compiled with different compilers, the ABI is not guaranteed to be compatible and things may fail at runtime. If you want to use a specific version of Python and setting -DPYTHON_EXECUTABLE=/path/to/python is not enough, you can try to set the two variables above explicitly when running CMake to get a consistent setup.
Dear @amadio,
I didn’t do anything special to my python installation.
I’ve always kept the operating system and Xcode up to date, and I never installed anything “manually”.
Can you please paste the equivalent of the lines below for your configuration (i.e., when you run cmake from scratch)?
-- Looking for python
-- Found PythonInterp: /usr/bin/python (found version "3.7.4")
-- Found PythonLibs: /usr/lib/libpython3.7m.so (found version "3.7.4")
-- Looking for python
-- Found PythonInterp: /usr/bin/python (found version "2.7.10")
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.16")
This is likely the problem. You are on 10.14, but using the SDK for 10.15, which has a newer version of Python headers. In this particular case, it might be fine to just ignore the check for the version. But if you can switch to using the SDK for 10.14, that will probably make the configuration problem go away.
Hi @amadio,
many thanks for figuring this out.
I think Apple made the mess.
Given that Catalina is coming out, their updates are not aligned.
For the time being I’ll stay with the patch.