]> git.lizzy.rs Git - rust.git/commitdiff
Infer a default musl_root for native builds
authorSamuel Holland <samuel@sholland.org>
Tue, 22 Aug 2017 21:24:29 +0000 (16:24 -0500)
committerSamuel Holland <samuel@sholland.org>
Tue, 22 Aug 2017 21:24:29 +0000 (16:24 -0500)
src/bootstrap/sanity.rs

index 436a13500f254054913b0259d0173ed3b847d315..a64a6130929cbb7c16792c9a844e999d751a4e56 100644 (file)
@@ -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() {