Skip to content

Error compiling example crate on NixOS #44

@jfredett

Description

@jfredett

I'll start with two caveats:

  1. I know very little about GPU programming, much less GPU programming in rust.
  2. My setup involves a major confounding factor (nixos), which might be the reason this is failing.

I recently decided to start messing around with GPU programming in rust. Landed on the rust-gpu crate and found my way here while trying to get set up via this discussion. This looked like the easiest way to get something running so I went ahead and set up this test repo to try it out. The current state of that repo is:

  1. A couple of initialization commits to set up the nix devshell w/ rust and such
  2. Importing the shader template repo
  3. Some clerical stuff (README, etc).

I then installed cargo-gpu via the instructions in the README, and attempted to cargo gpu build the test project, I got this error:

[2025-02-09T19:15:25Z ERROR cargo_gpu] No such file or directory (os error 2)
Error: No such file or directory (os error 2)

I poked around but didn't see anything obviously wrong, so I went ahead and reran with RUST_LOG=trace to get:

➜ RUST_LOG=trace cargo gpu build
[2025-02-09T20:21:59Z TRACE cargo_gpu] CLI args: [
        "/home/jfredett/code/rust-gpu-experiments/.devenv/state/cargo-install/bin/cargo-gpu",
        "build",
    ]
[2025-02-09T20:21:59Z DEBUG cargo_gpu::metadata] Querying Cargo metadata for "./Cargo.toml"
[2025-02-09T20:21:59Z DEBUG cargo_gpu::metadata] Matching shader crate path with manifest path: /home/jfredett/code/rust-gpu-experiments/Cargo.toml == /home/jfredett/code/rust-gpu-experiments/Cargo.toml?
[2025-02-09T20:21:59Z DEBUG cargo_gpu] building with final merged arguments: Build {
        install: Install {
            spirv_install: InstallArgs {
                dylib_path: "INTERNALLY_SET",
                shader_crate: "./",
                spirv_builder_source: None,
                spirv_builder_version: None,
                rust_toolchain: None,
                force_spirv_cli_rebuild: false,
                auto_install_rust_toolchain: false,
            },
        },
        build_args: BuildArgs {
            output_dir: "./",
            watch: false,
            no_default_features: false,
            features: [],
            target: "spirv-unknown-vulkan1.2",
            shader_target: "spirv-unknown-vulkan1.2",
            deny_warnings: false,
            debug: false,
            capability: [],
            extension: [],
            multimodule: false,
            spirv_metadata: None,
            relax_struct_store: false,
            relax_logical_pointer: false,
            relax_block_layout: false,
            uniform_buffer_standard_layout: false,
            scalar_block_layout: false,
            skip_block_layout: false,
            preserve_bindings: false,
        },
    }
[2025-02-09T20:21:59Z INFO  cargo_gpu::install] cache directory is '/home/jfredett/.cache/rust-gpu'
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Running `cargo tree` on /home/jfredett/code/rust-gpu-experiments
[2025-02-09T20:21:59Z TRACE cargo_gpu::spirv_source]   found Some("spirv-std v0.9.0")
[2025-02-09T20:21:59Z TRACE cargo_gpu::spirv_source] parsing spirv-std source and version from def: 'spirv-std v0.9.0'
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Parsed `rust-gpu` source and version: CratesIO("v0.9.0")
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Not cloning `rust-gpu` repo (https://github.com/Rust-GPU/rust-gpu) as it already exists at /home/jfredett/.cache/rust-gpu/rust-gpu-repo/v0_9_0
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Checking out `rust-gpu` repo at /home/jfredett/.cache/rust-gpu/rust-gpu-repo/v0_9_0 to v0.9.0
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Getting `rust-gpu` version date from /home/jfredett/.cache/rust-gpu/rust-gpu-repo/v0_9_0
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Parsed date for version v0.9.0: 2023-07-25
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Parsing `rust-toolchain.toml` at "/home/jfredett/.cache/rust-gpu/rust-gpu-repo/v0_9_0" for the used toolchain
[2025-02-09T20:21:59Z DEBUG cargo_gpu::spirv_source] Parsed version, date and toolchain channel from shader-defined `rust-gpu`: CratesIO("v0.9.0"), 2023-07-25, nightly-2023-05-27
[2025-02-09T20:21:59Z ERROR cargo_gpu] No such file or directory (os error 2)
Error: No such file or directory (os error 2)

I then went poking around and did find that final debug line, but due to caveat #1 I haven't been particularly successful in figuring out which file it's looking for.

Assuming this example is expected to build out of the box, I'm guessing this is a nix related issue, but I'm hoping I can get some insight before I start chasing geese.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions