Skip to content

Commit 706fc55

Browse files
committed
Infer a default musl_root for native builds
1 parent 5eba141 commit 706fc55

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bootstrap/sanity.rs

+7
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ pub fn check(build: &mut Build) {
159159

160160
// Make sure musl-root is valid
161161
if target.contains("musl") {
162+
// If this is a native target (host is also musl) and no musl-root is given,
163+
// fall back to the system toolchain in /usr before giving up
164+
if build.musl_root(target).is_none() && build.config.build == *target {
165+
let target = build.config.target_config.entry(target.clone())
166+
.or_insert(Default::default());
167+
target.musl_root = Some("/usr".into());
168+
}
162169
match build.musl_root(target) {
163170
Some(root) => {
164171
if fs::metadata(root.join("lib/libc.a")).is_err() {

0 commit comments

Comments
 (0)