Bazel@HEAD doesn't build on gcc 11
See original GitHub issueTrying 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:
- Created 3 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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:
and, the first three commits have to be incorporated into java_tools as well.
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?