Problem with the cc_proto_library rule under Bazel 4.0.0

2,450 views
Skip to first unread message

Ajith Ramanathan

unread,
Jan 21, 2021, 12:56:11 PM1/21/21
to bazel-discuss
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'



Yannic Bonenberger

unread,
Jan 21, 2021, 1:14:45 PM1/21/21
to Ajith Ramanathan, bazel-discuss
This is caused by an incompatible change: https://github.com/bazelbuild/bazel/issues/11694 

You need to upgrade your version of rules_proto to cfdc2fa31879c0aebe31ce7702b1a9c8a4be02d2 and it should work again.

Thanks,
Yannic

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/1327398f-679e-4ba7-9da6-9b911996848en%40googlegroups.com.

Ajith Ramanathan

unread,
Jan 21, 2021, 3:09:06 PM1/21/21
to bazel-discuss
Apologies for being dense.  How do I find the list of available tar.gz's?  I need to also update the urls, but though I can directly download the previous url (which I got from the README), I can't navigate the github.com/bazelbuild/rules_proto/archives tree to find the one corresponding to the commit you pointed me to.  I'm probably publicly displaying my ineptitude...

Thanks!

Yannic Bonenberger

unread,
Jan 21, 2021, 3:27:23 PM1/21/21
to Ajith Ramanathan, bazel-discuss

Ajith Ramanathan

unread,
Jan 22, 2021, 12:07:00 AM1/22/21
to bazel-discuss
Thank you!
Reply all
Reply to author
Forward
0 new messages