I opened an issue on github <https://github.com/protocolbuffers/protobuf/issues/24256>. I was trying to use the new protoc-gen-rust-grpc <https://github.com/hyperium/tonic/tree/master/protoc-gen-rust-grpc> plugin in bazel, should i be using a different setup with protobuf and udp imported as bazel rules? Is there an example available online? On Monday, November 3, 2025 at 2:06:17 PM UTC+1 Em Rauch wrote:
> Thanks for raising this. Do you mind opening an issue on github to > triage/discuss? > > Broadly we have test coverage running for two cases: bazel where you use > proto_library and cargo where you use the cratesio crate. The two have a > number of differences, most relevantly that when using bazel targets small > / fine-grained crates are a good idea for build hygiene, whereas with > cargo/cratesio comparatively 'fat' crates are the norm. > > Just from the error message, it is possible that what you are hitting > might stem from the fact that in our normal bazel build upb is a separate > crate, but in the cratesio build it is just a mod within the same crate > instead. _Though_ maybe thats a red herring. > > (Just because you sent a separate 'test' message, FYI this list has to be > moderated because of spam problems, so there's some delay between sending > and the email going through for the moderation process to happen). > > On Mon, Nov 3, 2025 at 7:58 AM Berend Lange <[email protected]> wrote: > >> The v4 version of protobuf does not compile with bazel unless its running >> with `--spawn-strategy=standalone` or `--spawn-strategy=local`. >> see repo >> https://github.com/berendjan/rust-bazel-starter.git >> This be easily reproduced with MODULE.bazel >> ``` >> """Rust-Temp""" >> >> module( >> name = "rust-temp", >> version = "0.0.0", >> ) >> >> bazel_dep(name = "rules_rust", version = "0.67.0") # >> https://github.com/bazelbuild/rules_rust/releases >> >> crate = use_extension("@rules_rust//crate_universe:extensions.bzl", >> "crate") >> >> crate.spec(package = "protobuf", version = "4.32.0-release") >> crate.from_specs() >> use_repo(crate, "crates") >> ``` >> >> BUILD.bazel >> ``` >> load("@rules_rust//rust:defs.bzl", "rust_binary") >> >> rust_binary( >> name = "test", >> srcs = glob(["**/*.rs"]), >> deps = [ >> "@crates//:protobuf", >> ], >> ) >> ``` >> >> main.rs >> ```rust >> pub fn main() { >> println!("hello world"); >> } >> ``` >> >> The error emitted: >> >> ``` >> ERROR: >> /home/berend/.cache/bazel/_bazel_berend/6b2aa4fe5e02f6a12410110ed2ccd580/external/rules_rust++crate+crates__protobuf-4.32.0-release/BUILD.bazel:27:13: >> >> Compiling Rust rlib protobuf v4.32.0-release (20 files) failed: (Exit 1): >> process_wrapper failed: error executing Rustc command (from target >> @@rules_rust++crate+crates__protobuf-4.32.0-release//:protobuf) >> bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/util/process_wrapper/process_wrapper >> >> --env-file ... (remaining 35 arguments skipped) >> >> Use --sandbox_debug to see verbose messages from the sandbox and retain >> the sandbox build root for debugging >> error: couldn't read >> `external/rules_rust++crate+crates__protobuf-4.32.0-release/src/upb/ >> lib.rs`: No such file or directory (os error 2) >> --> >> external/rules_rust++crate+crates__protobuf-4.32.0-release/src/shared.rs:75:1 >> | >> 75 | mod upb; >> | ^^^^^^^^ >> >> error: aborting due to 1 previous error >> >> Target //:test failed to build >> Use --verbose_failures to see the command lines of failed build steps. >> INFO: Elapsed time: 69.621s, Critical Path: 40.24s >> INFO: 223 processes: 17 action cache hit, 134 internal, 89 linux-sandbox. >> ERROR: Build did NOT complete successfully >> ``` >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Protocol Buffers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/protobuf/1f369855-f6aa-4a47-b106-33126cd771d0n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/protobuf/1f369855-f6aa-4a47-b106-33126cd771d0n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/protobuf/2c7ec04c-b258-4d6b-89f1-264a9e5960fdn%40googlegroups.com.
