question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CMake build gets stuck on ProGraML bazel step

See original GitHub issue

🐛 Bug

I have encountered a strange error where the CMake build appears to get “stuck” after the bazel build step of ProGraML. The build appears to hang indefinitely. Cancelling and re-running the CMake build works fine.

To Reproduce

Steps to reproduce the behavior:

$ cmake ....... # lots of flags (see below)

# <snip>
[3/9] Performing build_programl step for 'programl'
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Analyzing: 12 targets (5 packages loaded, 0 targets configured)
Analyzing: 12 targets (35 packages loaded, 209 targets configured)
Analyzing: 12 targets (50 packages loaded, 3390 targets configured)
INFO: Analyzed 12 targets (50 packages loaded, 6035 targets configured).
INFO: Found 12 targets...
[3 / 157] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[84 / 227] Compiling libs/exception/src/clone_current_exception_non_intrusive.cpp; 0s linux-sandbox ... (32 actions, 31 running)
[94 / 227] Compiling absl/base/internal/sysinfo.cc; 1s linux-sandbox ... (32 actions, 31 running)
[111 / 227] Compiling libs/regex/src/c_regex_traits.cpp; 2s linux-sandbox ... (32 actions, 31 running)
[115 / 227] Compiling libs/regex/src/c_regex_traits.cpp; 3s linux-sandbox ... (32 actions running)
[119 / 227] Compiling libs/regex/src/c_regex_traits.cpp; 5s linux-sandbox ... (32 actions running)
[140 / 237] Compiling libs/regex/src/c_regex_traits.cpp; 6s linux-sandbox ... (32 actions running)
[156 / 243] Compiling libs/regex/src/c_regex_traits.cpp; 8s linux-sandbox ... (32 actions, 31 running)
[174 / 250] Compiling libs/regex/src/cregex.cpp; 10s linux-sandbox ... (32 actions, 31 running)
[220 / 270] Compiling libs/regex/src/cregex.cpp; 12s linux-sandbox ... (32 actions, 31 running)
INFO: From Compiling labm8/cpp/string.cc:
external/labm8/labm8/cpp/string.cc:135:22: warning: implicit conversion from 'int' to 'char' changes value from 226 to -30 [-Wconstant-conversion]
        to.append(1, 226);
           ~~~~~~    ^~~
external/labm8/labm8/cpp/string.cc:136:22: warning: implicit conversion from 'int' to 'char' changes value from 130 to -126 [-Wconstant-conversion]
        to.append(1, 130);
           ~~~~~~    ^~~
external/labm8/labm8/cpp/string.cc:137:22: warning: implicit conversion from 'int' to 'char' changes value from 172 to -84 [-Wconstant-conversion]
        to.append(1, 172);
           ~~~~~~    ^~~
3 warnings generated.
[269 / 272] Compiling programl/ir/llvm/internal/text_encoder.cc; 5s linux-sandbox
INFO: Elapsed time: 24.341s, Critical Path: 14.47s
INFO: 146 processes: 1 internal, 145 linux-sandbox.
INFO: Build completed successfully, 146 total actions
INFO: Build completed successfully, 146 total actions

Cancel, re-run CMake and the build proceeds as normal:

$ cmake .... # same as before
# <snip>
[0/2] Performing build_programl step for 'programl'
Loading:
Loading: 0 packages loaded
Analyzing: 12 targets (0 packages loaded, 0 targets configured)
INFO: Analyzed 12 targets (0 packages loaded, 0 targets configured).
INFO: Found 12 targets...
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
INFO: Elapsed time: 0.425s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
[2/2] Completed 'programl'
# ....

Environment

Please fill in this checklist:

  • CompilerGym: development (0.2.2)
  • How you installed CompilerGym (conda, pip, source): source
  • OS: Ubuntu 20.04
  • Python version: 3.8
  • Build command you used (if compiling from source): cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" -DPython3_FIND_VIRTUALENV=FIRST -DCMAKE_BUILD_WITH_INSTALL_RPATH=true -S . -B build
  • GCC/clang version (if compiling from source): clang 10.0.0
  • Bazel version (if compiling from source): 4.2.2
  • Versions of any other relevant libraries:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mostafaelhoushicommented, Jun 9, 2022

In this PR #703, I removed the USES_TERMINAL TRUE option from the bazel build command in line 47, and linux-cmake-build job took 34 minutes! https://github.com/facebookresearch/CompilerGym/blob/45fb0a098261cf9d52ca2ad4222cfad65263847e/external/programl/CMakeLists.txt#L31-L48

0reactions
ChrisCumminscommented, Jun 9, 2022

Ah amazing, well done!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bazel doesn't exit after build when called from CMake ...
Bazel has a client/server model, where the server stays around for subsequent incremental builds. So this might be due to the server staying ......
Read more >
Bazel or CMake? : r/cpp - Reddit
IMO this approach is unusable for any serious project. Deps should be properly locked, or at least declared with version ranges. So I'd ......
Read more >
CMake gets stuck during Build - Usage
I'm starting to think that something is up with the GitHub Action. Once I have left the Log open on the background and...
Read more >
Build Systems: Bazel vs Make · Nalys Technical Blog - GitLab
With CMake, this process takes 2 steps. The first step is setting up the build environment through a CMakeLists.txt file, from which the...
Read more >
What is CMake and make, and what are they used for ... - Quora
First, some important definitions: Toolchain/Build System: This generally refers to all of the tools or software needed to compile software from source code ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found