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.

Bazel@HEAD doesn't build on gcc 11

See original GitHub issue

Trying to build Bazel@HEAD (009ce7b1d296e8f6b6e3d68189e6f26b47636663) is failing here with:

ERROR: /home/davido/.cache/bazel/_bazel_davido/0fa756dec521553dbe2dde6b6eac99b4/external/com_google_absl/absl/synchronization/BUILD.bazel:30:11: Compiling absl/synchronization/internal/graphcycles.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 31 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 31 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
external/com_google_absl/absl/synchronization/internal/graphcycles.cc: In member function 'void absl::lts_2020_02_25::synchronization_internal::GraphCycles::RemoveNode(void*)':
external/com_google_absl/absl/synchronization/internal/graphcycles.cc:451:26: error: 'numeric_limits' is not a member of 'std'
  451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
      |                          ^~~~~~~~~~~~~~
external/com_google_absl/absl/synchronization/internal/graphcycles.cc:451:49: error: expected primary-expression before '>' token
  451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
      |                                                 ^
external/com_google_absl/absl/synchronization/internal/graphcycles.cc:451:52: error: '::max' has not been declared; did you mean 'std::max'?
  451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
      |                                                    ^~~
      |                                                    std::max
In file included from /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/algorithm:62,
                 from external/com_google_absl/absl/synchronization/internal/graphcycles.cc:38:
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Target //src:bazel-bin-dev failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 52.484s, Critical Path: 7.30s
INFO: 75 processes: 16 internal, 59 linux-sandbox.
FAILED: Build did NOT complete successfully

Environment:

  $ gcc --version//src:bazel-bin
//src/main/cpp:client
//src/main/protobuf:command_server_cc_grpc
//third_party/grpc:grpc++_unsecure
@com_github_grpc_grpc//:grpc++_unsecure
@com_github_grpc_grpc//:gpr
@com_github_grpc_grpc//:gpr_base
@com_google_absl//absl/synchronization:synchronization
@com_google_absl//absl/synchronization:graphcycles_internal
Loading: 21 packages loaded
gcc (GCC) 11.0.0 20201204 (Red Hat 11.0.0-0)

Apparently abseil is outdated and/or is missing #include limits directive.

It seems, that Bazel itself doesn’t depend on abseil, but it’s rather a transitive dependency of gRPC:

  $ bazel query "somepath(src:bazel-bin, @com_google_absl//absl/synchronization:graphcycles_internal)"
//src:bazel-bin
//src/main/cpp:client
//src/main/protobuf:command_server_cc_grpc
//third_party/grpc:grpc++_unsecure
@com_github_grpc_grpc//:grpc++_unsecure
@com_github_grpc_grpc//:gpr
@com_github_grpc_grpc//:gpr_base
@com_google_absl//absl/synchronization:synchronization
@com_google_absl//absl/synchronization:graphcycles_internal
Loading: 21 packages loaded

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jeseccommented, Jan 2, 2022

Encountered the issue as well. I made a set of patches that resolves the issue.

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/29084/diffs

To deal with GCC 11 FTBFS, you would need to pick:

  • 8cc0e261a313dbf5e81bfeca2bafa3e12a991046
  • a129aeb333d83a4466ac2c996b84a113405acb4d
  • 9761509f9ccc3892f42425b904adf1ef10bcb1f4
  • absl’s 0e2c62da1dcaf6529abab952bdcc96c6de2d9506

and, the first three commits have to be incorporated into java_tools as well.

0reactions
glennpjcommented, Jan 22, 2022

How is java_tools patched? It is not part of the bazel distribution that I downloaded. Do I need to grab one of the releases from https://github.com/bazelbuild/java_tools/releases and place it in the bazel source directory?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build Fails Using GCC-11 Due to Some Missing Standard ...
Some C++ Standard Library headers have been changed to no longer include other headers that were being used internally by the library. As...
Read more >
Porting to GCC 11 - GNU Project
As such, C++ programs that used standard library components without including the right headers will no longer compile. The following headers ...
Read more >
bazel build is failing on gcc 11 · Issue #12702 - GitHub
Trying to build bazel on gcc 11: $ bazel --version bazel 4.0.0rc6 ... FAILED: Build did NOT complete successfully (0 packages loaded) ...
Read more >
GCC and Make - A Tutorial on how to compile, link and build ...
It is the standard compiler for most Unix-like operating systems. 1.3 Installing GCC on Mac OS X. Open a Terminal, and enter "...
Read more >
Advanced Optimization and New Capabilities of GCC 11
That does not mean that, as a user of SUSE Linux Enterprise 15, you are ... Because GCC 11 is newer, it can...
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