Skip to content

unknown rust_gpu attribute, expected rust_gpu::spirv_v0_9 in wrong workspace configuration  #626

Description

@SiebenCorgie

I stumbled upon this error while using spirv-std-0.10.0-alpha.1 from crates-io with cargo-gpu from crates-io as well (same version). I thought I'll report it, to safe others the search for a solution 🙂 .

I got a lot of those errors when using cargo gpu build:

error: unknown `rust_gpu` attribute, expected `rust_gpu::spirv_v0_9`. Do the versions of `spirv-std` and `rustc_codegen_spirv` match?
 --> /home/../src/index.crates.io-1949cf8c6b5b557f/spirv-std-0.10.0-alpha.1/src/sampler.rs:3:1
  |
3 | #[spirv(sampler)]
  | ^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the attribute macro `spirv` (in Nightly builds, run with -Z macro-backtrace for more info)

As the error suggests, I checked my spirv-std an cargo-gpu versions, via

cargo tree | grep "spriv-std" -> All are at 0.10.0-alpha.1

cargo gpu --version -> 0.10.0-alpha.1 (assuming that this will use the correct rustc_codegen_spirv version)

Solution

The real problem was, that I forgot to exclude the shader crate in the workspace. This seems to mess with the rustc_codegen_spirv version. Once I added it to the exclude list, I could build the shader again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions