-
Notifications
You must be signed in to change notification settings - Fork 7
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 compiling example crate on NixOS #44
Comments
Hey there! Thanks for the detailed report ❤️ Yeah, that could be a better error, sorry. I think it might be because you don't have |
Definitely was the lack of [2025-02-09T22:06:33Z 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-09T22:06:33Z DEBUG cargo_gpu::spirv_cli] toolchain nightly-2023-05-27 is already installed
[2025-02-09T22:06:33Z DEBUG cargo_gpu::spirv_cli] asking for consent to install the required toolchain
🦀 Install toolchain components (rust-src, rustc-dev, llvm-tools) with `rustup` [y/n]: [2025-02-09T22:06:33Z TRACE mio::poll] registering event source with poller: token=Token(0), interests=READABLE
[2025-02-09T22:06:33Z TRACE mio::poll] registering event source with poller: token=Token(1), interests=READABLE
🦀 Key(KeyEvent { code: Char('y'), modifiers: KeyModif
iers(0x0), kind: Press, state: KeyEventState(0x0) })
🦀 Installing toolchain components (rust-src, rustc-dev, llvm-tools) with `rustup`
info: downloading component 'rust-src'
info: installing component 'rust-src'
info: downloading component 'rustc-dev'
85.8 MiB / 85.8 MiB (100 %) 10.5 MiB/s in 9s ETA: 0s
info: installing component 'rustc-dev'
85.8 MiB / 85.8 MiB (100 %) 9.6 MiB/s in 8s ETA: 0s
info: downloading component 'llvm-tools'
32.7 MiB / 32.7 MiB (100 %) 9.6 MiB/s in 7s ETA: 0s
info: installing component 'llvm-tools'
32.7 MiB / 32.7 MiB (100 %) 10.4 MiB/s in 3s ETA: 0s
[2025-02-09T22:07:08Z DEBUG cargo_gpu::install] writing spirv-builder-cli source files into '/home/jfredett/.cache/rust-gpu/spirv-builder-cli/v0_9_0+nightly-2023-05-27'
[2025-02-09T22:07:08Z DEBUG cargo_gpu::spirv_source] Running `cargo tree` on /home/jfredett/code/rust-gpu-experiments
[2025-02-09T22:07:08Z TRACE cargo_gpu::spirv_source] found Some("spirv-std v0.9.0")
[2025-02-09T22:07:08Z TRACE cargo_gpu::spirv_source] parsing spirv-std source and version from def: 'spirv-std v0.9.0'
[2025-02-09T22:07:08Z DEBUG cargo_gpu::spirv_source] Parsed `rust-gpu` source and version: CratesIO("v0.9.0")
[2025-02-09T22:07:08Z 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-09T22:07:08Z 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-09T22:07:08Z DEBUG cargo_gpu::spirv_source] Getting `rust-gpu` version date from /home/jfredett/.cache/rust-gpu/rust-gpu-repo/v0_9_0
[2025-02-09T22:07:08Z DEBUG cargo_gpu::spirv_source] Parsed date for version v0.9.0: 2023-07-25
[2025-02-09T22:07:08Z 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-09T22:07:08Z 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-09T22:07:08Z DEBUG cargo_gpu::install] writing Cargo.toml
[2025-02-09T22:07:08Z DEBUG cargo_gpu::install] writing Cargo.lock
[2025-02-09T22:07:08Z DEBUG cargo_gpu::install] writing src/main.rs
[2025-02-09T22:07:08Z DEBUG cargo_gpu::install] writing src/lib.rs
[2025-02-09T22:07:08Z DEBUG cargo_gpu::install] writing src/args.rs
🦀 Compiling shader-specific `spirv-builder-cli` for ./
[2025-02-09T22:07:08Z DEBUG cargo_gpu::install] building artifacts with `cd "/home/jfredett/.cache/rust-gpu/spirv-builder-cli/v0_9_0+nightly-2023-05-27" && "cargo" "+nightly-2023-05-27" "build" "--release" "--no-default-features" "--features" "spirv-builder-pre-cli"`
error: no such command: `+nightly-2023-05-27`
help: invoke `cargo` through `rustup` to handle `+toolchain` directives
[2025-02-09T22:07:08Z ERROR cargo_gpu] ...build error!
Error: ...build error! This is definitely coming down to nix weirdness. Because my repo only has I assume that you require a specific version of nightly because of deep magic necessary for doing the Rust -> GPU magic? Wondering if I could just tell it to set the cache inside my repo in some ignored subdir then use the compiler stuff already in the devshell. |
I'm very much open to making any changes needed to support Nix. I've been using and appreciating the Nix package manager for a couple of years, but never actually made a flake yet. I understand enough that For now though, you can still certainly compile your shader! Just not with Haha yes the deep magic is that custom codegen backends are not in stable Rust yet. |
Cool, I appreciate the pointers, I'll dig into those and see what I can get running. It should certainly be possible to pull specific versions of packages. My project uses the fenix rust flake, which does allow for specific versions to be loaded. I suppose you could have a flake that provides a specific rust toolchain as one package (e.g., Anyway -- I should probably go learn how to compile things the hard way first, if I figure out something solid wrt flakes I'm happy to ping this issue to save some hunting later. Thanks again! |
Great, I'll ping this issue too if I make any progress 🤓 |
Hiyo. I've made a bit of progress, sufficient to run into a different issue (#45), though I don't love my solution so much, as it ultimately bypasses the nix stuff entirely and just installs rustup. Since I can't get it totally compiling I can't be sure it will work, but since it's just the expected rustup environment, I think it should. I did try (in the sistered flake.nix-fenix file) to have nix handle the install of the two rust versions, I wasn't able to figure out how to tell the I did see that tl;dr -- I think the rustup version should work, mod the mentioned issue, I'll probably see about trying the workaround suggested in there (manually running the version on PR #41) in this environment and see if that gets something compiling. |
Nice progress! I think it'd be worth opening a new dedicated issue to explore the potential of a faithful Nix flake that can build shaders. With the idea that And regarding the |
Heyo, busy on a different thing for a bit, back to gpu stuff! I got things kind of working, it was more difficult than just swapping the dependency. Full details in the experiment repo, but tl;dr -- In any case, those changes were sufficient to get to the point where it tries to build, but I then run into actual Rust errors that aren't just dependency issues so my hamfisted version bumping isn't going to resolve them. My total guess is I actually have a wrong version (whether too far ahead or too far behind, IDK) of spirt, since most of the errors have to do with unresolved imports/missing methods/missing fields/etc -- but I'm out of my depth at this point. The README has the full output. EDIT: Just decided to go hunting for one of the errors, and I see that in |
I'll start with two caveats:
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:I then installed
cargo-gpu
via the instructions in the README, and attempted tocargo gpu build
the test project, I got this error:I poked around but didn't see anything obviously wrong, so I went ahead and reran with
RUST_LOG=trace
to get: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!
The text was updated successfully, but these errors were encountered: