Errors you might see if you forget `bazel_dep(name = “protobuf” …)

If you forget to include the dependency on protobuf in your MODULE.bazel file while including a cc_proto_library target, you may see errors like the following when you try to build that target:

ERROR: /private/var/tmp/.../external/abseil-cpp+/absl/utility/BUILD.bazel: no such target '@@abseil-cpp+//absl/utility:if_constexpr': target 'if_constexpr' not declared in package 'absl/utility' defined by /private/var/tmp/.../external/abseil-cpp+/absl/utility/BUILD.bazel
ERROR: /private/var/tmp/.../external/protobuf+/src/google/protobuf/BUILD.bazel:483:11: no such target '@@abseil-cpp+//absl/utility:if_constexpr': target 'if_constexpr' not declared in package 'absl/utility' defined by /private/var/tmp/.../external/abseil-cpp+/absl/utility/BUILD.bazel and referenced by '@@protobuf+//src/google/protobuf:protobuf_lite'

Solution: add that dependency, like:

bazel_dep(name = "protobuf", version = "33.0-rc2")

With this, it builds nicely (aside from a huge cloud of warnings popping up from the proto libs?).


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *