about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-22 16:24:29 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-22 16:24:29 -0500
commit8606782bc155a5f2a3c292a76463a582167c744e (patch)
treedd1157093eb094113a96981fbbffe5390b2b0edb
parent1757a8701dfbc8627cce3a2f3624e39f525b8275 (diff)
downloadrust-8606782bc155a5f2a3c292a76463a582167c744e.tar.gz
rust-8606782bc155a5f2a3c292a76463a582167c744e.zip
Infer a default musl_root for native builds
-rw-r--r--src/bootstrap/sanity.rs9
1 files changed, 8 insertions, 1 deletions
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() {