Skip to content

Commit

Permalink
rustbuild: fix building std for musl targets
Browse files Browse the repository at this point in the history
closes #36143
  • Loading branch information
Jorge Aparicio committed Aug 30, 2016
1 parent 71ee82a commit bab6012
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/bootstrap/compile.rs
Expand Up @@ -93,16 +93,16 @@ pub fn std_link(build: &Build,
add_to_sysroot(&out_dir, &libdir);

if target.contains("musl") && !target.contains("mips") {
copy_third_party_objects(build, target, &libdir);
copy_third_party_objects(build, &libdir);
}
}

/// Copies the crt(1,i,n).o startup objects
///
/// Only required for musl targets that statically link to libc
fn copy_third_party_objects(build: &Build, target: &str, into: &Path) {
fn copy_third_party_objects(build: &Build, into: &Path) {
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
copy(&compiler_file(build.cc(target), obj), &into.join(obj));
copy(&build.config.musl_root.as_ref().unwrap().join("lib").join(obj), &into.join(obj));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/build.rs
Expand Up @@ -35,7 +35,7 @@ fn main() {
println!("cargo:rustc-link-lib=dl");
println!("cargo:rustc-link-lib=log");
println!("cargo:rustc-link-lib=gcc");
} else {
} else if !target.contains("musl") {
println!("cargo:rustc-link-lib=dl");
println!("cargo:rustc-link-lib=rt");
println!("cargo:rustc-link-lib=pthread");
Expand Down

0 comments on commit bab6012

Please sign in to comment.