protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.1k stars 15.43k forks source link

cc_proto_library doesn't work with Bazel 7 with Bzlmod #17414

Open comius opened 1 month ago

comius commented 1 month ago

What version of protobuf and what language are you using? Version: head Language: C++

What operating system (Linux, Windows, ...) and version? Linux

What did you do? Steps to reproduce the behavior:

$ bazel build  //src/google/protobuf/compiler:fake_plugin  --enable_bzlmod
src/google/protobuf/compiler/fake_plugin.cc:17:10: fatal error: google/protobuf/compiler/plugin.pb.h: No such file or directory
   17 | #include "google/protobuf/compiler/plugin.pb.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Further debugging shows:

bazel cquery  //src/google/protobuf/compiler:plugin_cc_proto --starlark:expr='providers(target)["CcInfo"].compilation_context.headers' --output=starlark --enable_bzlmod

doesn't include plugin.pb.h, whereas running it without --enable_bzlmod it does.

What did you expect to see Builds should work.

What did you see instead? Builds fail.

Anything else we should know about your project / environment For the reproduction to work, one PR setting up bzlmod is needed.

comius commented 1 month ago

cc @pcloudy @wyverald (I don't know where is the problem yet or how could a file just disappear)

esorot commented 1 month ago

@comius We're currently testing and upgrading our build for Bazel 7. We've been working on the breaking changes. In the meantime, you can still use Bazel 6 to build your code as a workaround for now.