configure python support with a non-global python version
adwait opened this issue · 2 comments
adwait commented
Issue: I set the local python version: pyenv local 3.x.x
, and tried configuring.
Running ./configure.sh --python
in a directory with a local python version fails with the following message (CMake does not pick up local python include directories):
CMake Error at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "3.11.8")
Call Stack (most recent call first):
/usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.20/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:148 (find_package)
Similar issue here: #24
Proposed fix: dynamically grab python include paths in the configure script.
adwait commented
Fix: add the following to the configure.sh script
cmake_opts="$cmake_opts \
-DPYTHON_INCLUDE_DIR=$(python -c "import sysconfig; print(sysconfig.get_path('include'))") \
-DPYTHON_LIBRARY=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")"