Skip to content

Commit 03d4e20

Browse files
committed
Add C++ flags to .bazelrc to build new abseil-cpp
abseil-cpp versions later after 20220623.1 require at least a C++14 compatible compiler to build. This, in turn, is required to build protobuf version 22 and later. Bazel 7 is already compatible, but Bazel 6 requires these flags.
1 parent 914693a commit 03d4e20

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.bazelrc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
build --enable_platform_specific_config
22

3-
#Windows needs --worker_quit_after_build due to workers not being shut down when the compiler tools need to be rebuilt (resulting in 'file in use' errors). See Bazel Issue#10498.
3+
# Needed to build versions of abseil-cpp newer than 20220624.1 under Bazel 6.
4+
# Can be removed after moving to Bazel 7. Borrowed from:
5+
# - https://github.com/bazelbuild/bazel/pull/20785
6+
#
7+
# At the same time, adding compiler flags like this does seem to make protobuf
8+
# recompile more often than it should. See:
9+
# - https://stackoverflow.com/questions/56880771/bazel-recompiles-protobuf-more-than-necessary
10+
# - https://github.com/bazelbuild/bazel/issues/7095
11+
build:linux --cxxopt=-std=c++17
12+
build:linux --host_cxxopt=-std=c++17
13+
build:macos --cxxopt=-std=c++17
14+
build:macos --host_cxxopt=-std=c++17
15+
build:windows --cxxopt=/std=c++17
16+
build:windows --host_cxxopt=/std=c++17
417

5-
build:windows --worker_quit_after_build --enable_runfiles
18+
# Windows needs --worker_quit_after_build due to workers not being shut down
19+
# when the compiler tools need to be rebuilt (resulting in 'file in use'
20+
# errors). See Bazel Issue#10498.
21+
build:windows --worker_quit_after_build --enable_runfiles
622

723
# Remove upon completing Bzlmod compatibility work.
824
# - https://github.com/bazelbuild/rules_scala/issues/1482

0 commit comments

Comments
 (0)