From 1208fd792db1a34b7a18d3bb0b43b943d99b82af Mon Sep 17 00:00:00 2001 From: Jan Bujak Date: Mon, 4 Oct 2021 07:03:10 +0000 Subject: [PATCH 1/3] Do not propagate host RUSTFLAGS when checking for WASM toolchain --- utils/wasm-builder/src/prerequisites.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/wasm-builder/src/prerequisites.rs b/utils/wasm-builder/src/prerequisites.rs index 0dad8b781ae5a..1dda20f5a5acd 100644 --- a/utils/wasm-builder/src/prerequisites.rs +++ b/utils/wasm-builder/src/prerequisites.rs @@ -138,6 +138,11 @@ 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("CARGO_ENCODED_RUSTFLAGS", ""); + run_cmd.env("CARGO_ENCODED_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()); From 3196155f2888093d8f532435fb01a98453a54e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 4 Oct 2021 09:44:25 +0200 Subject: [PATCH 2/3] Update utils/wasm-builder/src/prerequisites.rs --- utils/wasm-builder/src/prerequisites.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/wasm-builder/src/prerequisites.rs b/utils/wasm-builder/src/prerequisites.rs index 1dda20f5a5acd..6c8b582e8e966 100644 --- a/utils/wasm-builder/src/prerequisites.rs +++ b/utils/wasm-builder/src/prerequisites.rs @@ -142,6 +142,8 @@ fn check_wasm_toolchain_installed( // in the RUSTFLAGS then the check we do here will break unless we clear these. build_cmd.env("CARGO_ENCODED_RUSTFLAGS", ""); run_cmd.env("CARGO_ENCODED_RUSTFLAGS", ""); + build_cmd.env("RUSTFLAGS", ""); + run_cmd.env("RUSTFLAGS", ""); build_cmd.output().map_err(|_| err_msg.clone()).and_then(|s| { if s.status.success() { From 657e3550049303f98ab9c835f95fc371a05a4401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 4 Oct 2021 09:45:04 +0200 Subject: [PATCH 3/3] Update utils/wasm-builder/src/prerequisites.rs --- utils/wasm-builder/src/prerequisites.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/wasm-builder/src/prerequisites.rs b/utils/wasm-builder/src/prerequisites.rs index 6c8b582e8e966..c45f7933a1de3 100644 --- a/utils/wasm-builder/src/prerequisites.rs +++ b/utils/wasm-builder/src/prerequisites.rs @@ -140,10 +140,10 @@ fn check_wasm_toolchain_installed( // 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("CARGO_ENCODED_RUSTFLAGS", ""); - run_cmd.env("CARGO_ENCODED_RUSTFLAGS", ""); - build_cmd.env("RUSTFLAGS", ""); - run_cmd.env("RUSTFLAGS", ""); + 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() {