Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing rust code when compiling a rust_grpc_library target #2837

Open
satreix opened this issue Sep 5, 2024 · 0 comments
Open

Missing rust code when compiling a rust_grpc_library target #2837

satreix opened this issue Sep 5, 2024 · 0 comments

Comments

@satreix
Copy link

satreix commented Sep 5, 2024

Hi team 👋

Thanks for the awesome work invested in the rust ruleset.

I am attempting to migrate from rules_rust 0.47.1 to 0.49.3 (this is a PR with a repro).
I get the following error:

$ bazel test //...
ERROR: /home/runner/work/everest/everest/src/proto/helloworld/BUILD.bazel:37:18: Generating Rust protobuf stubs failed: (Exit 255): optional_output_wrapper failed: error executing RustProtocGen command (from target //src/proto/helloworld:helloworld_rust_grpc) 
  (cd /home/runner/.cache/bazel/_bazel_runner/b10ccf95f70cafd45527ff3170f0ab76/sandbox/linux-sandbox/611/execroot/_main && \
  exec env - \
  bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/proto/protobuf/optional_output_wrapper bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust/helloworld_grpc.rs -- 'com.google.devtools.build.lib.analysis.FilesToRunProvider$FullFilesToRunProvider@4f19aaaf' '--plugin=protoc-gen-grpc-rules_rust=bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_proto__grpc-compiler-0.6.2/protoc-gen-rust-grpc__bin' '--grpc-rules_rust_out=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust' '--plugin=protoc-gen-rules_rust=bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_proto__protobuf-codegen-2.8.2/protoc-gen-rust__bin' '--rules_rust_out=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust' '--descriptor_set_in=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_proto-descriptor-set.proto.bin' helloworld/helloworld.proto)
# Configuration: 5c8ee76a4e8e7a83bc2d45bc81bdf4944e47f188efe88858782477e5980db997
# Execution platform: @@platforms//host:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Usage: [optional_output1...optional_outputN] -- program [arg1...argn]
Args { inner: ["bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/proto/protobuf/optional_output_wrapper", "bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust/helloworld_grpc.rs", "--", "com.google.devtools.build.lib.analysis.FilesToRunProvider$FullFilesToRunProvider@4f19aaaf", "--plugin=protoc-gen-grpc-rules_rust=bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_proto__grpc-compiler-0.6.2/protoc-gen-rust-grpc__bin", "--grpc-rules_rust_out=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust", "--plugin=protoc-gen-rules_rust=bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_proto__protobuf-codegen-2.8.2/protoc-gen-rust__bin", "--rules_rust_out=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust", "--descriptor_set_in=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_proto-descriptor-set.proto.bin", "helloworld/helloworld.proto"] }
Os { code: 2, kind: NotFound, message: "No such file or directory" }
Analyzing: 166 targets (1108 packages loaded, 45770 targets configured)
[1,026 / 1,167] 11 / 43 tests; checking cached actions
ERROR: /home/runner/work/everest/everest/src/proto/helloworld/BUILD.bazel:37:18 Compiling Rust rlib helloworld_rust_grpc (3 files) failed: (Exit 255): optional_output_wrapper failed: error executing RustProtocGen command (from target //src/proto/helloworld:helloworld_rust_grpc) 
  (cd /home/runner/.cache/bazel/_bazel_runner/b10ccf95f70cafd45527ff3170f0ab76/sandbox/linux-sandbox/611/execroot/_main && \
  exec env - \
  bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/proto/protobuf/optional_output_wrapper bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust/helloworld_grpc.rs -- 'com.google.devtools.build.lib.analysis.FilesToRunProvider$FullFilesToRunProvider@4f19aaaf' '--plugin=protoc-gen-grpc-rules_rust=bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_proto__grpc-compiler-0.6.2/protoc-gen-rust-grpc__bin' '--grpc-rules_rust_out=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust' '--plugin=protoc-gen-rules_rust=bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_proto__protobuf-codegen-2.8.2/protoc-gen-rust__bin' '--rules_rust_out=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_rust_grpc.grpc.rust' '--descriptor_set_in=bazel-out/k8-fastbuild/bin/src/proto/helloworld/helloworld_proto-descriptor-set.proto.bin' helloworld/helloworld.proto)
# Configuration: 5c8ee76a4e8e7a83bc2d45bc81bdf4944e47f188efe88858782477e5980db997
# Execution platform: @@platforms//host:host

Inspecting the sandbox it looks like the .rs file is indeed missing:

$ tree $sandbox/darwin-sandbox/1907/execroot/_main
$sandbox/darwin-sandbox/1907/execroot/_main
└── bazel-out
    ├── darwin_x86_64-fastbuild
    │   └── bin
    │       └── src
    │           └── proto
    │               └── helloworld
    │                   ├── _virtual_imports
    │                   │   └── helloworld_proto
    │                   │       └── helloworld
    │                   │           └── helloworld.proto -> $execroot/_main/bazel-out/darwin_x86_64-fastbuild/bin/src/proto/helloworld/_virtual_imports/helloworld_proto/helloworld/helloworld.proto
    │                   ├── helloworld_proto-descriptor-set.proto.bin -> $execroot/_main/bazel-out/darwin_x86_64-fastbuild/bin/src/proto/helloworld/helloworld_proto-descriptor-set.proto.bin
    │                   └── helloworld_rust_grpc.grpc.rust
    └── darwin_x86_64-opt-exec-ST-d57f47055a04
        └── bin
            └── external
... more stuff

Going from there:

  1. could we get the error to tell the user what file is missing?
  2. am I using the ruleset wrong or is this a regression?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant