From 395f7549d940129a099e931569b6105a9a8ee45a Mon Sep 17 00:00:00 2001 From: tuguzT Date: Wed, 16 Jul 2025 11:34:27 +0300 Subject: [PATCH 1/3] Remove `RUSTC_WRAPPER` env --- crates/cargo-gpu/src/install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/cargo-gpu/src/install.rs b/crates/cargo-gpu/src/install.rs index 48e1ab8..c428490 100644 --- a/crates/cargo-gpu/src/install.rs +++ b/crates/cargo-gpu/src/install.rs @@ -301,6 +301,7 @@ package = "rustc_codegen_spirv" } cargo .env_remove("RUSTC") + .env_remove("RUSTC_WRAPPER") .env_remove("RUSTFLAGS") // ignore any externally supplied target dir, we want to build it in our cache dir .env_remove("CARGO_TARGET_DIR"); From e366e5e2bcb86a7515c8a874b8187383f934eec2 Mon Sep 17 00:00:00 2001 From: Firestar99 Date: Thu, 17 Jul 2025 12:59:25 +0200 Subject: [PATCH 2/3] use new CargoCmd from spirv-builder to handle env vars centrally --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- crates/cargo-gpu/src/install.rs | 24 +++--------------------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1dad73..70ee5cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -833,7 +833,7 @@ checksum = "6c89eaf493b3dfc730cda42a77014aad65e03213992c7afe0dff60a9f7d3dd94" [[package]] name = "rustc_codegen_spirv-types" version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5504c4441a84edcc27f4eca61de6fc8cf" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=de5a583abc748fa617b2b0b3065b2b85987da8ec#de5a583abc748fa617b2b0b3065b2b85987da8ec" dependencies = [ "rspirv", "serde", @@ -983,10 +983,11 @@ dependencies = [ [[package]] name = "spirv-builder" version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5504c4441a84edcc27f4eca61de6fc8cf" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=de5a583abc748fa617b2b0b3065b2b85987da8ec#de5a583abc748fa617b2b0b3065b2b85987da8ec" dependencies = [ "cargo_metadata", "clap", + "log", "memchr", "notify", "raw-string", diff --git a/Cargo.toml b/Cargo.toml index 6ef4f03..845678f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ exclude = [ resolver = "2" [workspace.dependencies] -spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "e6d017d5504c4441a84edcc27f4eca61de6fc8cf", default-features = false } +spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "de5a583abc748fa617b2b0b3065b2b85987da8ec", default-features = false } anyhow = "1.0.94" clap = { version = "4.5.37", features = ["derive"] } crossterm = "0.28.1" diff --git a/crates/cargo-gpu/src/install.rs b/crates/cargo-gpu/src/install.rs index c428490..cfbfdfb 100644 --- a/crates/cargo-gpu/src/install.rs +++ b/crates/cargo-gpu/src/install.rs @@ -7,7 +7,6 @@ use crate::target_specs::update_target_specs_files; use crate::{cache_dir, spirv_source::SpirvSource}; use anyhow::Context as _; use spirv_builder::SpirvBuilder; -use std::env; use std::path::{Path, PathBuf}; /// Represents a functional backend installation, whether it was cached or just installed. @@ -279,8 +278,8 @@ package = "rustc_codegen_spirv" .context("remove Cargo.lock")?; } - crate::user_output!("Compiling `rustc_codegen_spirv` from source {}\n", source,); - let mut cargo = std::process::Command::new("cargo"); + crate::user_output!("Compiling `rustc_codegen_spirv` from source {}\n", source); + let mut cargo = spirv_builder::cargo_cmd::CargoCmd::new(); cargo .current_dir(&install_dir) .arg(format!("+{toolchain_channel}")) @@ -289,24 +288,7 @@ package = "rustc_codegen_spirv" cargo.args(["-p", "rustc_codegen_spirv", "--lib"]); } - // Clear Cargo environment variables that we don't want to leak into the - // inner invocation of Cargo and mess with our `rustc_codegen_spirv` build. - for (key, _) in env::vars_os() { - let remove = key.to_str().is_some_and(|st| { - st.starts_with("CARGO_FEATURES_") || st.starts_with("CARGO_CFG_") - }); - if remove { - cargo.env_remove(key); - } - } - cargo - .env_remove("RUSTC") - .env_remove("RUSTC_WRAPPER") - .env_remove("RUSTFLAGS") - // ignore any externally supplied target dir, we want to build it in our cache dir - .env_remove("CARGO_TARGET_DIR"); - - log::debug!("building artifacts with `{cargo:?}`"); + log::debug!("building artifacts with `{cargo}`"); cargo .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit()) From 95c10e1b2924331f82616e5e04ff45e818e49276 Mon Sep 17 00:00:00 2001 From: tuguzT Date: Mon, 21 Jul 2025 12:19:45 +0300 Subject: [PATCH 3/3] Update spirv-builder --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70ee5cc..7cf3ee4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -833,7 +833,7 @@ checksum = "6c89eaf493b3dfc730cda42a77014aad65e03213992c7afe0dff60a9f7d3dd94" [[package]] name = "rustc_codegen_spirv-types" version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu?rev=de5a583abc748fa617b2b0b3065b2b85987da8ec#de5a583abc748fa617b2b0b3065b2b85987da8ec" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850#3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850" dependencies = [ "rspirv", "serde", @@ -983,7 +983,7 @@ dependencies = [ [[package]] name = "spirv-builder" version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu?rev=de5a583abc748fa617b2b0b3065b2b85987da8ec#de5a583abc748fa617b2b0b3065b2b85987da8ec" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850#3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850" dependencies = [ "cargo_metadata", "clap", diff --git a/Cargo.toml b/Cargo.toml index 845678f..02b1ead 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ exclude = [ resolver = "2" [workspace.dependencies] -spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "de5a583abc748fa617b2b0b3065b2b85987da8ec", default-features = false } +spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850", default-features = false } anyhow = "1.0.94" clap = { version = "4.5.37", features = ["derive"] } crossterm = "0.28.1"