Variable PYTHON_VERSION_MAJOR does not exist
wkazubski opened this issue · comments
When I try to build GNSS toolkit 13.4.0 on openSUSE, I get the following error after cmake command:
CMake Error at /usr/share/cmake/Modules/CMakePackageConfigHelpers.cmake:265 (message):
Variable PYTHON_VERSION_MAJOR does not exist
Call Stack (most recent call first):
CMakeLists.txt:248 (configure_package_config_file)
-- Configuring incomplete, errors occurred!
See also "/home/abuild/rpmbuild/BUILD/gnsstk-13.4.0/build/CMakeFiles/CMakeOutput.log".
error: Bad exit status from /var/tmp/rpm-tmp.Q3xc4O (%build)
the same error is when I use build.sh script.
Is something missing? Do I need to specify Python version manuaally?
We've not done any testing on OpenSUSE specifically.
It's hard to tell from the error message which package it's failing to find. However, you could try specifying the python location manually with the -P
flag to build.sh
... or the -DPYTHON_EXECUTABLE
parameter to cmake
.
Also, if you're building an RPM, there are .spec files in the rpm_files
directory that you might be able to use as guidance.
If all else fails, run build.sh
with verbose logging, and post the output here.
I looked into enclosed specfiles and found some useful arguments for cmake. My problem was solved by adding -DBUILD_EXT=ON but some other settings were necessary too.
Thanks for help
I think this is a bug in the CMakeLists.txt. If build.sh
isn't invoked with -e
, the default logic for setting PYTHON_VERSION_MAJOR
to dummy values won't get hit and the variable won't be defined when referenced later.
if( BUILD_EXT )
add_subdirectory( examples )
if( BUILD_PYTHON )
include( swig/PythonSetup.cmake )
add_subdirectory( swig )
else()
# keep cmake quiet
set( PYTHON_VERSION_MAJOR 0 )
set( PYTHON_VERSION_MINOR 0 )
set(GNSSTK_SWIG_MODULE_DIR "")
endif()
endif()
Yes, the answer seems to be to change that block in CMakeLists.txt to the following, which will be in the next release.
# keep cmake quiet
set(PYTHON_VERSION_MAJOR 0)
set(PYTHON_VERSION_MINOR 0)
set(GNSSTK_SWIG_MODULE_DIR "")
if( BUILD_EXT )
add_subdirectory( examples )
if( BUILD_PYTHON )
include( swig/PythonSetup.cmake )
add_subdirectory( swig )
endif()
endif()