Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake fails to detect Git version

Tags:

git

cmake

When I run cmake (in order to build TensorFlow on Windows) I get the error message

CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/ExternalProject.cmake:1811 (message):
  error: git version 1.6.5 or later required for 'git submodule update
  --recursive': GIT_VERSION_STRING=''

At lines 1810–1812 in ExternalProject.cmake I have these lines:

    if(GIT_VERSION_STRING VERSION_LESS 1.6.5)
      message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
    endif()

but I can't see where GIT_VERSION_STRING is assigned. Anyway it seems that GIT_VERSION_STRING is unassigned or assigned with an empty string or something something similar. This makes CMake fail to detect my Git version.

I have Git and git --version gives

git version 2.12.2.windows.2

Anyone knows what can be done about this error?

like image 931
HelloGoodbye Avatar asked Jun 25 '26 15:06

HelloGoodbye


1 Answers

In the file CMakeCache.txt in the folder from which I ran cmake, there was a variable called GIT_EXECUTABLE:FILEPATH which for some reason pointed to the wrong path (I had Git installed but not in that folder). So I deleted CMakeCache.txt (according to Tsyvarev's suggestion) and re-ran cmake, and I didn't have the same problem after than.

What I don't understand is why I GIT_EXECUTABLE:FILEPATH was assigned an incorrect path the first time I ran cmake but not the second time. Where did that incorrect path come from? And why did I get the problem only once and not both times I ran cmake?

like image 182
HelloGoodbye Avatar answered Jun 27 '26 09:06

HelloGoodbye



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!