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

Race condition about embed_genesis.cmake #2188

Closed
3 tasks
abitmore opened this issue May 31, 2020 · 2 comments · Fixed by #2250
Closed
3 tasks

Race condition about embed_genesis.cmake #2188

abitmore opened this issue May 31, 2020 · 2 comments · Fixed by #2250
Assignees
Labels
6 Build Impact flag identifying the build process

Comments

@abitmore
Copy link
Member

Build Error Description

When building with multiple cores, there is probably a race condition that multiple embed_genesis.cmake instances may be started at the same time and try to write to the same destination files, which leads to configure_file Problem configuring file errors.

Build Environment

Github Autobuild.

Console Logs (optional)

Ubuntu release build of https://github.com/bitshares/bitshares-core/runs/724112359

[ 65%] Linking CXX static library libgraphene_chain.a
make[2]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 65%] Built target graphene_chain
make[2]: Entering directory '/home/runner/work/bitshares-core/bitshares-core/_build'
make[2]: Entering directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 65%] Generating egenesis_brief.cpp, egenesis_full.cpp
Scanning dependencies of target graphene_egenesis_none
make[2]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
make[2]: Entering directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 65%] Building CXX object libraries/egenesis/CMakeFiles/graphene_egenesis_none.dir/egenesis_none.o
[ 65%] Linking CXX static library libgraphene_egenesis_none.a
make[2]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 65%] Built target graphene_egenesis_none
make[2]: Entering directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 65%] Generating egenesis_brief.cpp, egenesis_full.cpp
-- Generating egenesis
-- Chain-id: 4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8
-- Generating egenesis
-- Chain-id: 4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8
CMake Error at /home/runner/work/bitshares-core/bitshares-core/libraries/egenesis/embed_genesis.cmake:11 (configure_file):
  configure_file Problem configuring file


make[2]: *** [libraries/egenesis/egenesis_brief.cpp] Error 1
make[2]: *** Deleting file 'libraries/egenesis/egenesis_brief.cpp'
libraries/egenesis/CMakeFiles/graphene_egenesis_brief.dir/build.make:80: recipe for target 'libraries/egenesis/egenesis_brief.cpp' failed
make[1]: *** [libraries/egenesis/CMakeFiles/graphene_egenesis_brief.dir/all] Error 2
make[2]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1266: recipe for target 'libraries/egenesis/CMakeFiles/graphene_egenesis_brief.dir/all' failed
Scanning dependencies of target graphene_egenesis_full
make[2]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
make[2]: Entering directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 65%] Generating egenesis_brief.cpp, egenesis_full.cpp
-- Generating egenesis
-- Chain-id: 4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8
[ 66%] Building CXX object libraries/egenesis/CMakeFiles/graphene_egenesis_full.dir/egenesis_full.o
[ 66%] Linking CXX static library libgraphene_egenesis_full.a
make[2]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
[ 66%] Built target graphene_egenesis_full
make[1]: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
make: *** [all] Error 2
Makefile:146: recipe for target 'all' failed
make: Leaving directory '/home/runner/work/bitshares-core/bitshares-core/_build'
##[error]Process completed with exit code 2.

CORE TEAM TASK LIST

  • Evaluate Build Error
  • Provide build guidance
  • Create Bug Report
@abitmore abitmore added the 6 Build Impact flag identifying the build process label May 31, 2020
@abitmore abitmore added this to the 4.1.0 - Feature Release milestone May 31, 2020
@abitmore abitmore self-assigned this Aug 24, 2020
@abitmore
Copy link
Member Author

It's written in the cmake documentation:

add_custom_command ... is for adding a custom command to produce an output ... Do not list the output in more than one independent target that may build in parallel or the two instances of the rule may conflict (instead use the add_custom_target() command to drive the command and make the other targets depend on that one).

While we have code:

add_custom_command(
OUTPUT
"${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/egenesis_full.cpp"
add_library( graphene_egenesis_brief "${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp"
include/graphene/egenesis/egenesis.hpp )
add_library( graphene_egenesis_full "${CMAKE_CURRENT_BINARY_DIR}/egenesis_full.cpp"
include/graphene/egenesis/egenesis.hpp )

@abitmore
Copy link
Member Author

Fixed by #2250.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6 Build Impact flag identifying the build process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant