From 57c58ecb8549f26a31d9a4dab629c8cb9a865d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dj8yf0=CE=BCl?= Date: Fri, 10 Jan 2025 16:13:54 +0200 Subject: [PATCH] fix: remove CARGO_ENCODED_RUSTFLAGS for easier nested builds --- cargo-near-build/src/cargo_native/compile.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cargo-near-build/src/cargo_native/compile.rs b/cargo-near-build/src/cargo_native/compile.rs index fd61006f..0bfb8e03 100644 --- a/cargo-near-build/src/cargo_native/compile.rs +++ b/cargo-near-build/src/cargo_native/compile.rs @@ -118,6 +118,11 @@ where let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string()); let mut cmd = Command::new(cargo); + // removing env, which may be implicitly passed when bulding from within a build-script + // see https://github.com/near/cargo-near/issues/287 + // CARGO_ENCODED_RUSTFLAGS="-Awarnings" and RUSTFLAGS="-Awarnings" both result + // in mysterious failures of `cargo build --target wasm32-unknown-unknown` (rustc bug) + cmd.env_remove("CARGO_ENCODED_RUSTFLAGS"); cmd.envs(env); if let Some(path) = working_dir {