From 8606782bc155a5f2a3c292a76463a582167c744e Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Tue, 22 Aug 2017 16:24:29 -0500 Subject: [PATCH] Infer a default musl_root for native builds --- src/bootstrap/sanity.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 436a13500f2..a64a6130929 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -151,8 +151,15 @@ pub fn check(build: &mut Build) { panic!("the iOS target is only supported on macOS"); } - // Make sure musl-root is valid if specified + // Make sure musl-root is valid if target.contains("musl") && !target.contains("mips") { + // If this is a native target (host is also musl) and no musl-root is given, + // fall back to the system toolchain in /usr before giving up + if build.musl_root(*target).is_none() && build.config.build == *target { + let target = build.config.target_config.entry(target.clone()) + .or_insert(Default::default()); + target.musl_root = Some("/usr".into()); + } match build.musl_root(*target) { Some(root) => { if fs::metadata(root.join("lib/libc.a")).is_err() { -- 2.44.0