Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'master' tag missing from github breaking cmake builds #3663

Open
Bam4d opened this issue Nov 15, 2021 · 14 comments
Open

'master' tag missing from github breaking cmake builds #3663

Bam4d opened this issue Nov 15, 2021 · 14 comments
Labels

Comments

@Bam4d
Copy link

Bam4d commented Nov 15, 2021

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.

@Bam4d Bam4d added the bug label Nov 15, 2021
j-blue-arz added a commit to j-blue-arz/labyrinth that referenced this issue Nov 16, 2021
apparently google has dropped the master tag, main now works:
google/googletest#3663
@crtrott
Copy link

crtrott commented Nov 16, 2021

Wow wonder how many repos that broke ...

@theShmoo
Copy link

Thanks for the fast issue description and proposed fix!

Wanted to report it myself after my CI build broke.

Great community here 👍

@muthu-sioux
Copy link

Maybe makes sense to update the readme. It still refers to master :-)

@assafpr
Copy link
Contributor

assafpr commented Nov 16, 2021

@Bam4d , Any reason you don't apply the suggested fix? (change GIT_TAG)? or do i miss something as a brand new user?

@Bam4d
Copy link
Author

Bam4d commented Nov 16, 2021

@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 :)

@assafpr
Copy link
Contributor

assafpr commented Nov 16, 2021

@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 .

@j-blue-arz
Copy link

j-blue-arz commented Nov 16, 2021

@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.

@stullemitbrot
Copy link

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.

karl-nilsson added a commit to karl-nilsson/CavalierContours that referenced this issue Nov 22, 2021
karl-nilsson added a commit to karl-nilsson/CavalierContours that referenced this issue Nov 22, 2021
gerrit-photon pushed a commit to vmware/photon that referenced this issue Nov 23, 2021
Issue: google/googletest#3663

Change-Id: I1379f39e180869ef25d4d5f8e5963baa1f7e432e
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/14681
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Shreenidhi Shedi <sshedi@vmware.com>
SebAcki added a commit to rreinecke/global-gradient-based-groundwater-model that referenced this issue Nov 26, 2021
utokusa added a commit to utokusa/OS-251 that referenced this issue Nov 26, 2021
@RanaSaleh
Copy link

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

@Bam4d
Copy link
Author

Bam4d commented Nov 30, 2021

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)

dschlaep added a commit to DrylandEcology/SOILWAT2 that referenced this issue Dec 6, 2021
- the default branch name is now "main"; see google/googletest#3663
ajordan5 added a commit to ajordan5/UBLOX_read that referenced this issue Feb 17, 2022
GermanAizek added a commit to GermanAizek/gtest_cmake_ExternalProject_Add that referenced this issue Apr 29, 2022
Maintainers changed branch to `main`
Reference: google/googletest#3663
@WysokiStudent
Copy link

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=

@assafpr
Copy link
Contributor

assafpr commented Jun 27, 2022

@WysokiStudent thanks, I've added PR #3918

@bazzilic
Copy link

if you guys can like not break things unnecessarily that'd be great thanks

@mdumas2
Copy link

mdumas2 commented Aug 28, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests