Skip to content

cmake build fails at the end if building in an incomplete repo (With missing tags) #224

@JaredDiCioccio

Description

@JaredDiCioccio

When building with cmake, the build will fail if you are inside a git repo but have not fetched tags.

Sometimes cloning a 'large' repo results in TLS errors, probably due to firewall/man-in-the-middle certs (like zscaler), etc... An easy workaround is to do a shallow clone with --depth 1 followed by a fetch with --unshallow. Doing this can result in no git tags being fetched, even after 'unshallowing'. This causes the cmake build to report a failure.

jared@ubuntu:~/gravity/build$ cat  /home/jared/gravity/build/gravity_external-prefix/src/gravity_external-stamp/gravity_external-build-err.log 

fatal: No names found, cannot describe anything. <----- highlighted for emphasis by the author

make[5]: *** [api/cpp/libgravity.so] Error 128
make[5]: *** Deleting file 'api/cpp/libgravity.so'
make[4]: *** [api/cpp/CMakeFiles/gravity.dir/all] Error 2
make[3]: *** [all] Error 2

The error message is actually the output of running git describe --tags when none are present, which I imagine the build does at some point to populate version.txt

Steps to reproduce:

  1. git clone git@github.com:aphysci/gravity.git --depth 1
  2. cd gravity
  3. git fetch --unshallow
  4. ... build with cmake ...

The build will fail at the end.

You can easily fix this by fetching tags, or perhaps a fetch --all.

Mostly leaving this here as documentation. Pretty obscure case but the shallow clone to bypass tls errors comes up relatively often.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions