'master' tag missing from github breaking cmake builds
Bam4d opened this issue ยท 14 comments
Describe the bug
It looks like the "master" tag has been dropped, so all builds that use cmake to clone the repositories are breaking if they use the "master" tag.
Its an easy fix (change master to main) but this bug will probably help other people that run into this issue.
CMake Error at googletest-download/googletest-prefix/tmp/googletest-gitclone.cmake:40 (message):
Failed to checkout tag: 'master'
Steps to reproduce the bug
using the standard cmake builder for googletest:
cmake_minimum_required(VERSION 3.10.0)
project(googletest-download NONE)
include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
SOURCE_DIR "${GOOGLE_TEST_DIR}/googletest-src"
BINARY_DIR "${GOOGLE_TEST_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
As soon as i try to build my project the above cmake error occurs.
What operating system and version are you using?
Ubuntu Linux 20.04
What build system are you using?
cmake version 3.21.2
Additional context
Change GIT_TAG to 'main' the problem fixes itself.
Wow wonder how many repos that broke ...
Thanks for the fast issue description and proposed fix!
Wanted to report it myself after my CI build broke.
Great community here ๐
Maybe makes sense to update the readme. It still refers to master :-)
@Bam4d , Any reason you don't apply the suggested fix? (change GIT_TAG)? or do i miss something as a brand new user?
@assafpr It's totally fine to just change the tag (I did this in my own projects). I made the bug report because I imagined many people would run into this issue and wanted to show that the fix was quick and easy :)
@Bam4d , I'll try to push it to the origin repository if it is OK with you (it is your fix after all) and if @j-blue-arz is not going to try and push the fix he did in j-blue-arz/labyrinth@8806f07 .
@assafpr There is nothing to push. The fix I made was for my own repo.
There is a cmake googletest tutorial out there which uses FetchContent_Declare cmake directive to download googletest from this repo. The GIT_TAG property of directive was set to master in the tutorial. The removal of this tag in the repository broke the cmake build for all developers who based their cmake on this tutorial.
As I see it, there are only two options here:
- Either the 'main' tag will be renamed to 'master' in this repository (which I doubt to happen), or
- Every user sets the GIT_TAG property to 'main' in his/her code, which is also the 'fix' OP proposed. And also the one I chose.
Edit: an older version of the tutorial I mentioned apparently did not use FetchContent_Declare, but ExternalProject_Add. This is the directive used in the first post by Bam4d.
This change makes it impossible to recreate former versions of all clients which use this repo - not really the basic idea of source code repository.
Hii ,
after changing the GIT_TAG to main , i am getting a new error in the next step:
CMake Error at ../googletest-download/googletest-prefix/tmp/googletest-gitupdate.cmake:25 (message):
Failed to get the hash for HEAD:
Regards
Hii , after changing the GIT_TAG to main , i am getting a new error in the next step: CMake Error at ../googletest-download/googletest-prefix/tmp/googletest-gitupdate.cmake:25 (message): Failed to get the hash for HEAD:
Regards
You might need to do a clean of your test build folder as well (I think I've seen this issue and this worked for me)
I've just spotted that warning messages and tests were not updated and still point to the now non-existant master branch. See for example:
https://github.com/google/googletest/blob/main/googlemock/test/gmock-spec-builders_test.cc#L2062=
@WysokiStudent thanks, I've added PR #3918
if you guys can like not break things unnecessarily that'd be great thanks
I am using gtest_force_shared_crt, and when using CMake with the "master" branch, it is generating automatically. How can I fix this issue?