diff --git a/library/unwind/build.rs b/library/unwind/build.rs index 126e41d1e20..31af390253b 100644 --- a/library/unwind/build.rs +++ b/library/unwind/build.rs @@ -2,8 +2,14 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); - let target = env::var("TARGET").expect("TARGET was not set"); + println!("cargo:rerun-if-env-changed=CARGO_CFG_MIRI"); + if env::var_os("CARGO_CFG_MIRI").is_some() { + // Miri doesn't need the linker flags or a libunwind build. + return; + } + + let target = env::var("TARGET").expect("TARGET was not set"); if target.contains("android") { let build = cc::Build::new();