OpenCMISS / iron

Source code repository for OpenCMISS-Iron
9 stars 62 forks source link

Build issue, CMake error: cmake_policy GET given policy "CMP0094" which is not known to this version of CMake in FindPython #192

Closed vraj004 closed 2 years ago

vraj004 commented 2 years ago

Attempting to build opencmiss-iron using setup.git approach. Machine details: CMake 3.9.6 GCC 6.4.0 Python 3.6.4


Error output: [ 85%] Checking SOWING sources are present [ 85%] Built target SM_sowing_sources [ 85%] Built target get_sources [ 88%] Creating config. -- Attempting to use gnu compilers. CMake Error at /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:1112 (cmake_policy): cmake_policy GET given policy "CMP0094" which is not known to this version of CMake. Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

CMake Error at /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:290 (list): list does not recognize sub-command TRANSFORM Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2415 (_python_get_path_suffixes) /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

CMake Error at /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:370 (list): list does not recognize sub-command TRANSFORM Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2416 (_python_get_names) /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

CMake Error at /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:370 (list): list does not recognize sub-command TRANSFORM Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2510 (_python_get_names) /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

CMake Error at /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:290 (list): list does not recognize sub-command TRANSFORM Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2516 (_python_get_path_suffixes) /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

CMake Error at /home/common/easybuild/software/CMake/3.9.6/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:195 (message): Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): "REASON_FAILURE_MESSAGE" Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2984 (find_package_handle_standard_args) /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/vrajagopal/opencmiss_local/opencmiss/build/manage/release/config/Release/CMakeFiles/CMakeOutput.log". gmake[5]: [config/Release/stamp/manage_config-create] Error 1 gmake[4]: [CMakeFiles/manage_config.dir/all] Error 2 gmake[3]: [all] Error 2 gmake[2]: [setup_manage-prefix/src/setup_manage-stamp/setup_manage-build] Error 2 gmake[1]: [CMakeFiles/setup_manage.dir/all] Error 2 gmake: [all] Error 2

hsorby commented 2 years ago

You will need CMake version 3.15 as a minimum to build using the setup script. I will set the minimum version required to 3.15.

vraj004 commented 2 years ago

Continuing on this journey, I updated cmake to cmake-3.15.1. I get the following error: CMake Error at /home/common/easybuild/software/CMake/3.15.1/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:195 (message): Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): "REASON_FAILURE_MESSAGE" Call Stack (most recent call first): /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2984 (find_package_handle_standard_args) /home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:140 (find_package)

hsorby commented 2 years ago

I suspect that there might be more to this error. It seems like something has not been found, but the something is not shown in this error message. What OS is this running on? I have just tested this with CMake 3.16 on Ubuntu and things worked there.

hsorby commented 2 years ago

My first thought would be that numpy is not installed into the Python environment that has been detected.

vraj004 commented 2 years ago

I have numpy installed within python3.6.4. Should that not be picked up?

hsorby commented 2 years ago

It should, I need a bit more context to help determine what is going wrong. From the information supplied above I cannot figure out what has happened.

vraj004 commented 2 years ago

What additional info do you need? I'd like to document it all here so that others who search for this issue will learn from seeing the problem being worked out here.

hsorby commented 2 years ago

If you can configure the following in the same environment to what you are using above and post back all of the output:

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

project(TestFindPython)

set(CMAKE_MODULE_PATH "/home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules")

find_package(Python COMPONENTS Interpreter Development)
vraj004 commented 2 years ago

Hi Hugh, would you like me to make these changes in the CMakeLists.txt file in the setup folder?

vraj004 commented 2 years ago

Also, do i need to run this still before starting? https://github.com/OpenCMISS/utilities/tree/develop/scripts

vraj004 commented 2 years ago

I checked in FindPython3.cmake and it says it has found numpy.

hsorby commented 2 years ago

Sorry, I would like you to create a CMakeLists.txt file and add the above as content, save in a temporary directory somewhere and then:

mkdir build
cd build
cmake ../

I would like to see the output of that configuration.

vraj004 commented 2 years ago

-- The C compiler identification is GNU 6.4.0 -- The CXX compiler identification is GNU 6.4.0 -- Check for working C compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/cc -- Check for working C compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/c++ -- Check for working CXX compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /home/common/easybuild/software/CMake/3.15.1/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:195 (message): Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): "REASON_FAILURE_MESSAGE" Call Stack (most recent call first): opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython/Support.cmake:2984 (find_package_handle_standard_args) opencmiss_local/opencmiss/install/share/cmake/Modules/FindPython.cmake:415 (include) CMakeLists.txt:7 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/vrajagopal/cmake-test/CMakeFiles/CMakeOutput.log".

hsorby commented 2 years ago

And if you were to comment out the line

# set(CMAKE_MODULE_PATH "/home/vrajagopal/opencmiss_local/opencmiss/install/share/cmake/Modules")

like so. What does that result in.

vraj004 commented 2 years ago

configuring done. no issues. -- The C compiler identification is GNU 6.4.0 -- The CXX compiler identification is GNU 6.4.0 -- Check for working C compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/cc -- Check for working C compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/c++ -- Check for working CXX compiler: /home/common/easybuild/software/GCCcore/6.4.0/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Python: /home/common/easybuild/software/Python/3.6.4-foss-2018a/bin/python3.6 (found version "3.6.4") found components: Interpreter Development -- Configuring done -- Generating done -- Build files have been written to: /home/vrajagopal/cmake-test

hsorby commented 2 years ago

I cannot read properly, REASON_FAILURE_MESSAGE is only available from CMake version 3.16. That means the minimum version actually needs to be 3.16 and not 3.15. Sorry about that, I will modify the setup script and if you update it ?might? work.

vraj004 commented 2 years ago

Thanks, Hugh. I successfully installed opencmiss-iron using cmake 3.16.4 and gcc 9.3.0.

Key issues resolved: Minimum CMake version required to compile opencmiss-iron is 3.16. Issue was not to do with oc-iron. Instead it is about cmake commands not being recognised by older versions of cmake.