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 4.0.0 - "ERROR: cc_toolchain does not have mandatory provider 'ProtoInfo'. " when building project with protobuf

See original GitHub issue

Description of the problem / feature request:

I am developing a Paragraph framework that builds with bazel and depends on protobuf. After updating bazel to version 4.0.0 I got an error:

ERROR: /usr/local/google/home/misaev/.cache/bazel/_bazel_misaev/c13aabee7e17f0c08e7db24fb9d21398/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'.

The issue appeared only after bazel was updated, the issue disappears if bazel is downgraded to the version 3.7.2. It’s possible the issue is with protobuf itself and/or rules_proto, but since the error is fixed with downgrading, I assume this is a reasonable place for a bug description.

Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

The simplest way is

  1. clone paragraph
git clone git@github.com:google/paragraph.git
cd paragraph/
  1. checkout initial commit that does not have dependency on Tensorflow (hence it’s apparent the issue is with combination of bazel and rules_proto/protobuf)
git checkout db503f48fabbac47fe9a597feacb7be2226b6832
  1. build it and it fails
bazel test ...

What operating system are you running Bazel on?

Linux 5.7.17-1rodete4-amd64 #1 SMP Debian 5.7.17-1rodete4 (2020-10-01) x86_64 GNU/Linux

What’s the output of bazel info release?

misaev@misaev2:~/dev/paragraph$ bazel info release
release 4.0.0

Have you found anything relevant by searching the web?

Yes, it looks like Tensorflow had similar issues yesterday updating to bazel 4.0.0 and shortly after that performing a rollback. Paragraph pretty much only depends on protobuf (through rules_proto) and abseil, so it should be more convenient to use it as a minimally failing example.

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
weimchcommented, Dec 20, 2021

Hi, I found that just add below flags when you build with bazel-4.0 or above, everything will be fine.

build --incompatible_blacklisted_protos_requires_proto_info=false
1reaction
Yanniccommented, Jan 23, 2021

This is caused by an incompatible change that was flipped in Bazel 4.0.0: https://github.com/bazelbuild/bazel/issues/11694

All you need to do to fix that issue is to upgrade either rules_proto to at least cfdc2fa31879c0aebe31ce7702b1a9c8a4be02d2 or make sure you use at least Protobuf 3.13 in you build.

See also https://groups.google.com/g/bazel-discuss/c/gRGUbnpxkUU/m/JV4wZnm6AQAJ

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with the cc_proto_library rule under Bazel 4.0.0
I've been having some problems using protocol buffers in a C++ project that, I believe, are ... I've verified that Bazel 3.7.2 does...
Read more >
bazel编译protobuf时“ERROR: cc_toolchain does not have ...
bazel 编译protobuf时“ERROR: cc_toolchain does not have mandatory provider 'ProtoInfo'. “
Read more >
Protocol Buffer Rules - Bazel
It is passed as a command-line flag to Blaze. Several features require a proto-compiler to be invoked on the proto_library rule itself. It's...
Read more >
fresh install of bazel fails to build grpc 1.48.0? - Stack Overflow
As mentioned here, a temporary workaround is changing the cc toolchain from local to local_linux in (your home)/.cache/bazel/bazel(your ...
Read more >
CHANGELOG.md - Google Git
ERROR : Build did NOT complete successfully; Bazel no longer increases the delay between progress updates when there is no cursor control.
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