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

error when building utoipa-swagger-ui with crate_universe #3100

Open
oconnor663 opened this issue Dec 13, 2024 · 0 comments
Open

error when building utoipa-swagger-ui with crate_universe #3100

oconnor663 opened this issue Dec 13, 2024 · 0 comments

Comments

@oconnor663
Copy link

Here's a GitHub gist you can clone to repro the issue I'm seeing: https://gist.github.com/oconnor663/deaad1cacdcbf98e8e21f73b163827b5. The minimal MODULE.bazel file looks like this:

module(
    name = "repro",
    version = "0.1.0",
)
bazel_dep(name = "rules_rust", version = "0.55.6")
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.spec(package = "utoipa-swagger-ui", version = "8.0.3")
crate.from_specs()
use_repo(crate, "crates")

The trivial rust_binary target that depends on that crate is:

package(default_visibility = ["//visibility:public"])

load("@rules_rust//rust:defs.bzl", "rust_binary")

rust_binary(
    name = "bin",
    srcs = ["repro.rs"],
    deps = [
        "@crates//:utoipa-swagger-ui",
    ],
)

If I build that, I get this error ("folder ... does not exist"):

$ git clone https://gist.github.com/deaad1cacdcbf98e8e21f73b163827b5.git repro
...
$ cd repro
$ bazel build :bin
INFO: Analyzed target //:bin (0 packages loaded, 0 targets configured).
ERROR: /private/var/tmp/_bazel_jacko/92410d0e3373f265902564b48493ac12/external/rules_rust~~crate~crates__utoipa-swagger-ui-8.0.3/BUILD.bazel:18
:13: Compiling Rust rlib utoipa_swagger_ui v8.0.3 (6 files) failed: (Exit 1): process_wrapper failed: error executing Rustc command (from targe
t @@rules_rust~~crate~crates__utoipa-swagger-ui-8.0.3//:utoipa_swagger_ui) bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_r
ust~/util/process_wrapper/process_wrapper --env-file ... (remaining 79 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
error: #[derive(RustEmbed)] folder '/private/var/tmp/_bazel_jacko/92410d0e3373f265902564b48493ac12/sandbox/darwin-sandbox/127/execroot/_main/ba
zel-out/darwin_arm64-fastbuild/bin/external/rules_rust~~crate~crates__utoipa-swagger-ui-8.0.3/_bs.out_dir/swagger-ui-5.17.14/dist/' does not ex
ist. cwd: '/private/var/tmp/_bazel_jacko/92410d0e3373f265902564b48493ac12/sandbox/darwin-sandbox/130/execroot/_main'

(Another error follows that that's pretty clearly downstream of this file-does-not-exist problem.)

utoipa-swagger-ui isn't my crate, but I think the basic issue is that its build.rs is generating some code that embeds a path into its target/ dir. I'm guessing that plays poorly with the way Bazel/rules_rust/crate_universe compiles crates under different sandbox dirs, but I'm not really sure. Is there a way for me to specify this dependency that will build? Apologies if this isn't really a rules_rust issue.

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