Skip to content

Issue #45: Tested PR fix #50

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

Open
PatD123 opened this issue Feb 25, 2025 · 2 comments
Open

Issue #45: Tested PR fix #50

PatD123 opened this issue Feb 25, 2025 · 2 comments

Comments

@PatD123
Copy link

PatD123 commented Feb 25, 2025

Tested PR #41 on my Windows computer.

I had the same issue as #45. So I tried the solution posted as the first reply (here). After that I got the issue mentioned later in the thread (here).

Here are the full logs:

PS C:\Users\Patrick\Documents\__Projects__\cargo-gpu> cargo run --bin cargo-gpu -- build --shader-crate C:\Users\Patrick\Documents\__Projects__\demiurge\examples\01_spinning_triangle\spinning_triangle_shader --force-spirv-cli-rebuild --auto-install-rust-toolchain
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   C:\Users\Patrick\Documents\__Projects__\cargo-gpu\crates\cargo-gpu\Cargo.toml
workspace: C:\Users\Patrick\Documents\__Projects__\cargo-gpu\Cargo.toml
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.54s
     Running `target\debug\cargo-gpu.exe build --shader-crate C:\Users\Patrick\Documents\__Projects__\demiurge\examples\01_spinning_triangle\spinning_triangle_shader --force-spirv-cli-rebuild --auto-install-rust-toolchain`
🦀 Compiling shader-specific `spirv-builder-cli` for C:\Users\Patrick\Documents\__Projects__\demiurge\examples\01_spinning_triangle\spinning_triangle_shader
warning: unused manifest key `lints` (may be supported in a future version)

consider passing `-Zlints` to enable this feature.
    Updating crates.io index
   Compiling spirv-builder-cli v0.1.0 (C:\Users\Patrick\AppData\Local\rust-gpu\spirv-builder-cli\v0_9_0+nightly-2023-05-27)
warning: unused import: `MetadataPrintout`
  --> src\main.rs:14:36
   |
14 | use spirv_builder::{CompileResult, MetadataPrintout, ModuleResult, SpirvBuilder};
   |                                    ^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused `Result` that must be used
   --> src\main.rs:138:9
    |
138 | /         builder.watch(move |compile_result| {
139 | |             handle_compile_result(&compile_result, &args_for_result);
140 | |         });
    | |__________^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
    |
138 |         let _ = builder.watch(move |compile_result| {
    |         +++++++

warning: `spirv-builder-cli` (bin "spirv-builder-cli") generated 2 warnings (run `cargo fix --bin "spirv-builder-cli"` to apply 1 suggestion)
    Finished release [optimized] target(s) in 7.07s
🦀 Running `spirv-builder-cli` to compile shader at \\?\C:\Users\Patrick\Documents\__Projects__\demiurge\examples\01_spinning_triangle\spinning_triangle_shader...
thread 'main' panicked at 'failed to execute cargo build: Error { kind: NotFound, message: "program not found" }', C:\Users\Patrick\.cargo\registry\src\index.crates.io-6f17d22bba15001f\spirv-builder-0.9.0\src\lib.rs:738:10
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\std\src\panicking.rs:578
   1: core::panicking::panic_fmt
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\core\src\panicking.rs:67
   2: core::result::unwrap_failed
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\core\src\result.rs:1651
   3: spirv_builder::invoke_rustc
   4: spirv_builder::SpirvBuilder::build
   5: spirv_builder_cli::handle_compile_result
   6: <std::io::Write::write_fmt::Adapter<T> as core::fmt::Write>::write_str
   7: std::rt::lang_start::{{closure}}
   8: std::rt::lang_start_internal::closure$2
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\std\src\rt.rs:148
   9: std::panicking::try::do_call
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\std\src\panicking.rs:485
  10: std::panicking::try
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\std\src\panicking.rs:449
  11: std::panic::catch_unwind
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\std\src\panic.rs:142
  12: std::rt::lang_start_internal
             at /rustc/1a5f8bce74ee432f7cc3aa131bc3d6920e06de10/library\std\src\rt.rs:148
  13: main
  14: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  15: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  16: BaseThreadInitThunk
  17: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[2025-02-18T16:48:26Z ERROR cargo_gpu] build failed

    Stack backtrace:
       0: std::backtrace_rs::backtrace::dbghelp64::trace
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
       1: std::backtrace_rs::backtrace::trace_unsynchronized
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
       2: std::backtrace::Backtrace::create
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\backtrace.rs:331
       3: std::backtrace::Backtrace::capture
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\backtrace.rs:296
       4: anyhow::Error::msg<ref$<str$> >
                 at C:\Users\Patrick\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\anyhow-1.0.94\src\backtrace.rs:27
       5: anyhow::__private::format_err
                 at C:\Users\Patrick\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\anyhow-1.0.94\src\lib.rs:691
       6: cargo_gpu::build::Build::run
                 at .\crates\cargo-gpu\src\build.rs:73
       7: cargo_gpu::run
                 at .\crates\cargo-gpu\src\main.rs:153
       8: cargo_gpu::main
                 at .\crates\cargo-gpu\src\main.rs:98
       9: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b\library\core\src\ops\function.rs:250
      10: core::hint::black_box
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b\library\core\src\hint.rs:477
      11: std::sys::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b\library\std\src\sys\backtrace.rs:152
      12: std::rt::lang_start::closure$0<tuple$<> >
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b\library\std\src\rt.rs:199
      13: std::rt::lang_start_internal::closure$0
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\rt.rs:168
      14: std::panicking::try::do_call
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\panicking.rs:587
      15: std::panicking::try
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\panicking.rs:550
      16: std::panic::catch_unwind
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\panic.rs:358
      17: std::rt::lang_start_internal
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b/library\std\src\rt.rs:164
      18: std::rt::lang_start<tuple$<> >
                 at /rustc/43ca9d18e333797f0aa3b525501a7cec8d61a96b\library\std\src\rt.rs:198
      19: main
      20: invoke_main
                 at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
      21: __scrt_common_main_seh
                 at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
      22: BaseThreadInitThunk
      23: RtlUserThreadStart
Error: build failed
error: process didn't exit successfully: `target\debug\cargo-gpu.exe build --shader-crate C:\Users\Patrick\Documents\__Projects__\demiurge\examples\01_spinning_triangle\spinning_triangle_shader --force-spirv-cli-rebuild --auto-install-rust-toolchain` (exit code: 1)

Additionally, what installed toolchains do I need. This is what I get from mine:

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-2023-05-27-x86_64-pc-windows-msvc
nightly-2023-09-30-x86_64-pc-windows-msvc
nightly-2024-01-05-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)

active toolchain
----------------

nightly-x86_64-pc-windows-msvc (default)
rustc 1.86.0-nightly (43ca9d18e 2025-02-08)
@tombh
Copy link
Collaborator

tombh commented Mar 1, 2025

Thanks for putting this in its own repo. I can't be sure that this error is independent from the new code in PR #41, but my hunch is that it is independent.

From what I can see in the logs it's getting quite far, which is good news. It's managed to compile the spirv-builder-cli binary using the Rust toolchain version required by your particular shader. Which indicates that your rustup is indeed working and cargo-gpu is able to call it (there should never be a need to manually install any toolchains).

The error itself seems to be in calling spirv_builder::invoke_rustc which is actually in the rust-gpu repo. It doesn't seem to be able to find the cargo binary. I suppose that could be to do with the custom ENV var that spirv-builder-cli sets in order to use custom toolchains. But I'm not sure.

Would you be up for finding this line in your local dependencies? https://github.com/Rust-GPU/rust-gpu/blob/6e2c84d4fe64e32df4c060c5a7f3e35a32e45421/crates/spirv-builder/src/lib.rs#L797 It would interesting to see what your ENV is at that point and whether it causes cargo to not be found.

@bspeice
Copy link
Contributor

bspeice commented Mar 29, 2025

Having this same issue on Windows. I was able to edit the spirv-builder source in the Cargo cache to start adding some eprintln!() calls:

    let mut cargo = Command::new("cargo");
    eprintln!("PATH: {}", env::var("PATH").unwrap());
    cargo.args([

and it appears that PATH doesn't have any folder where cargo is available:

PATH: C:\Users\<name>\AppData\Local\rust-gpu\spirv-builder-cli\v0_9_0+nightly-2023-05-27

Still trying to see if I configure out why the path is getting changed.

EDIT: I think this is caused by #20 - because it sets the PATH on Windows, the Rust GPU spirv-builder is unable to locate cargo when it runs.

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

3 participants