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

Building the cpp-simple example prints a fatal message and hangs for a long time before finishing #1091

Closed
roberthbailey opened this issue Oct 2, 2019 · 5 comments · Fixed by #1701
Labels
good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! kind/bug These are bugs.
Milestone

Comments

@roberthbailey
Copy link
Member

What happened: Tried to build the cpp-simple application. The build hangs, with the error fatal: not a git repository (or any of the parent directories): .git (see full output below).

What you expected to happen: A successful build.

How to reproduce it (as minimally and precisely as possible): Check out the master branch, cd examples/cpp-simple; make.

Anything else we need to know?:

Environment:

  • Agones version: HEAD
  • Kubernetes version (use kubectl version): n/a
  • Cloud provider or hardware configuration: n/a
  • Install method (yaml/helm): n/a
  • Troubleshooting guide log(s):
$ make build
cd /Users/robertbailey/Work/agones && docker build -f /Users/robertbailey/Work/agones/examples/cpp-simple//Dockerfile --tag=gcr.io/agones-images/cpp-simple-server:0.10 .
Sending build context to Docker daemon  612.8MB
Step 1/17 : FROM gcc:8 as builder
 ---> f7858e844b06
Step 2/17 : WORKDIR /project
 ---> Running in b9f00356eb49
Removing intermediate container b9f00356eb49
 ---> 7c646916c0de
Step 3/17 : RUN wget -q https://cmake.org/files/v3.14/cmake-3.14.1-Linux-x86_64.sh -O /cmake-3.14.1-Linux-x86_64.sh
 ---> Running in d1ebb362af59
Removing intermediate container d1ebb362af59
 ---> b9063c7e9065
Step 4/17 : RUN mkdir /opt/cmake
 ---> Running in 9745a9d64bde
Removing intermediate container 9745a9d64bde
 ---> da69e694b77d
Step 5/17 : RUN sh /cmake-3.14.1-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
 ---> Running in d102596aaa1c
CMake Installer Version: 3.14.1, Copyright (c) Kitware
This is a self-extracting archive.
The archive will be extracted to: /opt/cmake

Using target directory: /opt/cmake
Extracting, please wait...

Unpacking finished successfully
Removing intermediate container d102596aaa1c
 ---> 0ba7af421b90
Step 6/17 : RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
 ---> Running in 446f1cb448ab
Removing intermediate container 446f1cb448ab
 ---> 85ec5294fd26
Step 7/17 : RUN cmake --version
 ---> Running in 55085ea402e0
cmake version 3.14.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).
Removing intermediate container 55085ea402e0
 ---> c20f0e50f9df
Step 8/17 : COPY ./sdks/cpp sdk
 ---> c409ea8d8b41
Step 9/17 : RUN cd sdk && mkdir -p .build &&     cd .build &&     cmake .. -DCMAKE_BUILD_TYPE=Release -DAGONES_SILENT_OUTPUT=ON -G "Unix Makefiles" -Wno-dev &&     cmake --build . --target install
 ---> Running in e481d0c5aafb
fatal: not a git repository (or any of the parent directories): .git
@roberthbailey roberthbailey added the kind/bug These are bugs. label Oct 2, 2019
@roberthbailey
Copy link
Member Author

Ok, it looks like I wasn't being patient enough. It would be great if the output didn't say fatal and hang for a long time though. Maybe we can tweak the cmake configuration to suppress this message somehow?

@roberthbailey roberthbailey added good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! labels Oct 22, 2019
@roberthbailey roberthbailey changed the title Unable to build cpp-simple Building the cpp-simple example prints a fatal message and hangs for a long time before finishing Oct 22, 2019
@aLekSer
Copy link
Collaborator

aLekSer commented Jul 20, 2020

I think using GIT_DIR could solve an issue:
https://stackoverflow.com/a/15146761/13278970

@dsazonoff
Copy link
Contributor

Hello, this text is an output from "git describe --tags --abbrev=0" command. (https://github.com/googleforgames/agones/blob/master/sdks/cpp/CMakeLists.txt#L47)

To fix this it's possible to remove this script from CMakeLists.txt

# Getting version from git
find_package(Git QUIET)
set(AGONES_VERSION "0.0.0")
if (Git_FOUND)
    execute_process(
        COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        RESULT_VARIABLE result
        OUTPUT_VARIABLE output
    )
    if (${result} EQUAL 0)
        string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" AGONES_VERSION ${output})
    endif()
else()
    message(WARNING "Git was not found. Current Agones version is set to ${AGONES_VERSION}")
endif()

But you should set an AGONES_VERSION to something from environment. For example set(AGONES_VERSION ENV{agones_version_from_shell_variable}).

Note. This variable is used to save a version number to cmake generated scripts for cpp sdk. I think that you don't need this in the most cases. So you can just remove this code and remove a VERSION ${AGONES_VERSION} from a project macro (https://github.com/googleforgames/agones/blob/master/sdks/cpp/CMakeLists.txt#L60)

@aLekSer
Copy link
Collaborator

aLekSer commented Jul 20, 2020

Thanks @dsazonoff, I got this results empirically. Curious what project macro in cmake does. The result of git describe ... would be v1.7.0 on the master version, which somewhere in between v1.7.0 and v1.8.0.

@aLekSer
Copy link
Collaborator

aLekSer commented Jul 20, 2020

Result of .build/agonesConfig.cmake after running make run-sdk-command SDK_FOLDER=cpp COMMAND=build is accurate:

set(agones_VERSION 1.7.0)

That's why, we should not remove this command:

execute_process(
        COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
...
)

@markmandel markmandel added this to the 1.8.0 milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! kind/bug These are bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants