Closed
Description
I discovered that running cargo build
with rustc environment variable is set to "/home/tmvkrpxl0/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc" (path to nightly rustc on my pc) fails with below error:
🦀 Running `spirv-builder-cli` to compile shader at /home/tmvkrpxl0/CLionProjects/beam/game...
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/home/tmvkrpxl0/.cargo/bin/sccache /home/tmvkrpxl0/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -Zcodegen-backend=/home/tmvkrpxl0/.cache/rust-gpu/spirv-builder-cli/_home_tmvkrpxl0_CLionProjects_rust-gpu+0_9_0+nightly-2024-11-22/librustc_codegen_spirv.so -Zbinary-dep-depinfo -Csymbol-mangling-version=v0 '-Zcrate-attr=feature(register_tool)' '-Zcrate-attr=register_tool(rust_gpu)' -Coverflow-checks=off -Cdebug-assertions=off -Zinline-mir=off -Zmir-enable-passes=-GVN --target /home/tmvkrpxl0/.cache/rust-gpu/target-specs/spirv-unknown-vulkan1.2.json --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
--- stderr
error: Error loading target specification: `unknown` os can only be used on particular targets; use `none` for bare-metal targets. Run `rustc --print target-list` for a list of built-in targets
thread 'main' panicked at src/main.rs:152:38:
called `Result::unwrap()` on an `Err` value: BuildFailed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2025-04-27T14:20:59Z ERROR cargo_gpu] build failed
Error: build failed
This is problematic on projects that uses nightly. My project is currently set up in this way:
root (workspace root that uses nightly rust):
ㄴ game (contains build.rs that runs cargo gpu command)
ㄴ macros
ㄴ shader-path (compiled by cargo-gpu)
ㄴ shader-rasterizer (compiled by cargo-gpu)
ㄴ types-shared
ㄴ utils
Since the workspace root uses nightly, it sets rustc version to nightly and fails to compile with same error.
Metadata
Metadata
Assignees
Labels
No labels