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.

Reply via email to