From 886c42c5c84fbda24cb3281ac431e3ef44a87a3b Mon Sep 17 00:00:00 2001 From: Koute Date: Mon, 4 Oct 2021 22:28:51 +0900 Subject: [PATCH] Do not propagate host RUSTFLAGS when checking for WASM toolchain (#9926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Do not propagate host RUSTFLAGS when checking for WASM toolchain * Update utils/wasm-builder/src/prerequisites.rs * Update utils/wasm-builder/src/prerequisites.rs Co-authored-by: Bastian Köcher --- substrate/utils/wasm-builder/src/prerequisites.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/substrate/utils/wasm-builder/src/prerequisites.rs b/substrate/utils/wasm-builder/src/prerequisites.rs index 0dad8b781a..c45f7933a1 100644 --- a/substrate/utils/wasm-builder/src/prerequisites.rs +++ b/substrate/utils/wasm-builder/src/prerequisites.rs @@ -138,6 +138,13 @@ fn check_wasm_toolchain_installed( build_cmd.env_remove("CARGO_TARGET_DIR"); run_cmd.env_remove("CARGO_TARGET_DIR"); + // Make sure the host's flags aren't used here, e.g. if an alternative linker is specified + // in the RUSTFLAGS then the check we do here will break unless we clear these. + build_cmd.env_remove("CARGO_ENCODED_RUSTFLAGS"); + run_cmd.env_remove("CARGO_ENCODED_RUSTFLAGS"); + build_cmd.env_remove("RUSTFLAGS"); + run_cmd.env_remove("RUSTFLAGS"); + build_cmd.output().map_err(|_| err_msg.clone()).and_then(|s| { if s.status.success() { let version = run_cmd.output().ok().and_then(|o| String::from_utf8(o.stdout).ok());