Hi. I've been having some problems using protocol buffers in a C++ project that, I believe, are directly related to Bazel 4.0.0. I've verified that Bazel 3.7.2 does not have this problem.
The problem. When I try and build a cc_proto_library I get the following message:
"Starting local Bazel server and connecting to it...
ERROR: C:/users/ajith/_bazel_ajith/vnwuv2iw/external/com_google_protobuf/BUILD:975:21: in proto_lang_toolchain rule @com_google_protobuf//:cc_toolchain: '@com_google_protobuf//:cc_toolchain' does not have mandatory provider 'ProtoInfo'.
ERROR: Analysis of target '//unnamed_project/main:attributes_cc_proto' failed; build aborted: Analysis of target '@com_google_protobuf//:cc_toolchain' failed
INFO: Elapsed time: 8.152s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (18 packages loaded, 583 targets configured)"
My WORKSPACE configuration:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_google_absl_oss_federation",
strip_prefix = "federation-head-deccf4d5b5b296134675d474d244f777d3e077ff",
sha256 = "f263ebcc648e62d5cc638fc47dddb737a8fa96b7db6b299b3e20cc9de4aa9b33",
)
load("@com_google_absl_oss_federation//:federation_deps.bzl", "federation_deps")
federation_deps()
# rules_proto defines abstract rules for building Protocol Buffers.
http_archive(
name = "rules_proto",
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
urls = [
],
)
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
And my .bazelrc:
build --cxxopt='-std:c++17'