From 706fc559532f24e77d0f0c1319723848ed82eb67 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sat, 25 Feb 2017 23:30:10 -0600 Subject: [PATCH] Infer a default musl_root for native builds --- src/bootstrap/sanity.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 245002019ef57..3ee11135165b8 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -159,6 +159,13 @@ pub fn check(build: &mut Build) { // Make sure musl-root is valid if target.contains("musl") { + // 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() {