optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
117 stars 34 forks source link

CMake : errors concerning GetGitRevisionDescription.cmake during configure step #357

Closed arnodu closed 1 year ago

arnodu commented 1 year ago

Hi,

This is related to my previous issue #348 and the error during cmake configuration when git is invoked to fetch the branch/version string. #353 partially fixes my issues, but in very specific cases, i still get the error.

The error message i get looks like :

-- The CXX compiler identification is GNU 9.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/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 external/git/cmake/GetGitRevisionDescription.cmake:71 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  external/git/cmake/GetGitRevisionDescription.cmake:160 (_git_find_closest_git_dir)
  CMakeLists.txt:495 (get_git_head_revision)
CMake Error at external/git/cmake/GetGitRevisionDescription.cmake:71 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  external/git/cmake/GetGitRevisionDescription.cmake:160 (_git_find_closest_git_dir)
  external/git/cmake/GetGitRevisionDescription.cmake:200 (get_git_head_revision)
  external/git/cmake/GetGitRevisionDescription.cmake:268 (git_describe)
  CMakeLists.txt:501 (git_get_exact_tag)
CMake Error at external/git/cmake/GetGitRevisionDescription.cmake:71 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  external/git/cmake/GetGitRevisionDescription.cmake:160 (_git_find_closest_git_dir)
  external/git/cmake/GetGitRevisionDescription.cmake:321 (get_git_head_revision)
  CMakeLists.txt:503 (git_get_branch)
CMake Error at external/git/cmake/GetGitRevisionDescription.cmake:71 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  external/git/cmake/GetGitRevisionDescription.cmake:160 (_git_find_closest_git_dir)
  external/git/cmake/GetGitRevisionDescription.cmake:355 (get_git_head_revision)
  CMakeLists.txt:510 (git_get_short_hash)
CMake Error at external/git/cmake/GetGitRevisionDescription.cmake:71 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  external/git/cmake/GetGitRevisionDescription.cmake:160 (_git_find_closest_git_dir)
  external/git/cmake/GetGitRevisionDescription.cmake:285 (get_git_head_revision)
  CMakeLists.txt:522 (git_local_changes)
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1") 
-- Found MPI: TRUE (found version "3.1")  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.10") 
-- RapidJSON library not found, JSON support will be disabled.
-- Performing Test CXX_COMPILER_SUPPORTS_SANITIZE_MODULE
-- Performing Test CXX_COMPILER_SUPPORTS_SANITIZE_MODULE - Success
-- Performing Test HAVE___BUILTIN_UNREACHABLE
-- Performing Test HAVE___BUILTIN_UNREACHABLE - Success
-- Configuring incomplete, errors occurred!
See also "/builds/<..>/build/external/Build/bitpit_external/CMakeFiles/CMakeOutput.log".

In my specific case, bitpit is in a git submodule for my application AND i try to compile my application into a gitlab-ci job. As a result, the git command to retrieve the branch name for bitpit fails (because of this) and i get this error.

Anyway, there is a patch that i think you should include in your GetGitRevisionDescription.cmake : https://github.com/rpavlik/cmake-modules/commit/3933abd958596bc660d180a22e86991ac477b68b .