[CMake] Cmake not finding the Python libraries
Dimitrova, Maria
maria.dimitrova at helsinki.fi
Thu Nov 2 06:10:17 EDT 2017
Hello,
I am trying to compile a program based on a setup script calling Cmake but I end up with a strange situation where it complains that it cannot find PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS. I double checked that indeed "which python" returns the one from Anaconda, and that all the environmental variables for it are exported:
export PATH=/MYPATH/anaconda2/bin:${PATH}
export PYTHON_LIBRARY=/MYPATH/anaconda2/lib/libpython2.7.so
export PYTHON_INCLUDE_DIR=/MYPATH/anaconda2/include/python2.7
export PYTHON_LIBRARIES="/MYPATH/anaconda2/lib/libpython2.7.so"
export PYTHON_INCLUDE_DIRS="/MYPATH/anaconda2/include/python2.7"
export PYTHON_EXECUTABLE="/MYPATH/anaconda2/bin/python"
(MYPATH stands for my home directory in this email)
"echo $PYTHON_LIBRARIES" and "echo $PYTHON_INCLUDE_DIRS" are giving the correct paths, as well.
Cmake is evoked through a ./setup script which can also accept the following arguments:
--cmake-executable=<CMAKE_EXECUTABLE> Set the CMake executable [default: cmake].
--cmake-options=<STRING> Define options to CMake [default: ''].
and I have tried passing the variables there:
./setup --fc=ifort --extra-fc-flags='-xAVX -axCORE-AVX2,CORE-AVX-I' --cc=icc --extra-cc-flags='-xAVX -axCORE-AVX2,CORE-AVX-I' --cxx=icc --extra-cxx-flags='-xAVX -axCORE-AVX2,CORE-AVX-I' --cmake-options='-DPYTHON_LIBRARIES=/MYPATH/anaconda2/lib/libpython2.7.so -DPYTHON_INCLUDE_DIRS=/MYPATH/anaconda2/include/python2.7'
Yet it crashes with the following output:
CMake Error at /MYPATH/cmake-3.9.4-Linux-x86_64/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "2.7")
Call Stack (most recent call first):
/MYPATHcmake-3.9.4-Linux-x86_64/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
/MYPATH/cmake-3.9.4-Linux-x86_64/share/cmake-3.9/Modules/FindPythonLibs.cmake:262 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:23 (find_package)
Could the problem be caused by a bug in the setup script or something that I have misunderstood about Cmake?
Best regards,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171102/04daed6b/attachment.html>
More information about the CMake
mailing list