diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-10-06 08:35:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-06 08:35:43 -0700 |
| commit | 9ceef4e004a521821d227cf6cfd4726b44e4ac8d (patch) | |
| tree | 6af2da9c8f19a24c7c0ff47e5b5abd34d4bcffd1 | |
| parent | a19e22e2e98134d90fe59e7927d7d9f5a6c00d07 (diff) | |
| parent | 7937f6ccdea38fd76a9ef98b41742d9318e25e4b (diff) | |
| download | rust-9ceef4e004a521821d227cf6cfd4726b44e4ac8d.tar.gz rust-9ceef4e004a521821d227cf6cfd4726b44e4ac8d.zip | |
Rollup merge of #36972 - nastevens:fix-rustbuild-per-target-musl-root, r=alexcrichton
Fix rustbuild per-target musl root In #36292, support was added to target musl libc for ARM targets using rustbuild. Specifically, that change allowed the addition of per-target `musl-root` options in the rustbuild `config.toml` so that multiple targets depending on musl could be built. However, that implementation contained a couple of omissions: the `musl-root` option was added to the config, but was never added to the TOML parsing, and therefore was not actually being loaded from `config.toml`. This PR rectifies that. Using these changes and a heavily modified version of the buildbot Docker container, I have been able to build rust targeting `armv7-unknown-linux-musleabihf` and have successfully run the binaries on a Raspberry Pi 3. I'm also planning to test `arm-unknown-linux-musleabi` and `arm-unknown-linux-musleabihf` systems, but have no reason to believe that this change would not simply work on those targets.
| -rw-r--r-- | src/bootstrap/compile.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/config.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/sanity.rs | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 16dbcae99fa..418c3a48ed3 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -90,16 +90,16 @@ pub fn std_link(build: &Build, add_to_sysroot(&out_dir, &libdir); if target.contains("musl") && !target.contains("mips") { - copy_musl_third_party_objects(build, &libdir); + copy_musl_third_party_objects(build, target, &libdir); } } /// Copies the crt(1,i,n).o startup objects /// /// Only required for musl targets that statically link to libc -fn copy_musl_third_party_objects(build: &Build, into: &Path) { +fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) { for &obj in &["crt1.o", "crti.o", "crtn.o"] { - copy(&build.config.musl_root.as_ref().unwrap().join("lib").join(obj), &into.join(obj)); + copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj)); } } diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index a8434c3efb3..69bd7a76991 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -158,6 +158,7 @@ struct TomlTarget { cc: Option<String>, cxx: Option<String>, android_ndk: Option<String>, + musl_root: Option<String>, } impl Config { @@ -268,6 +269,7 @@ impl Config { } target.cxx = cfg.cxx.clone().map(PathBuf::from); target.cc = cfg.cc.clone().map(PathBuf::from); + target.musl_root = cfg.musl_root.clone().map(PathBuf::from); config.target_config.insert(triple.clone(), target); } diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index c4e6399c2c3..969cd70fd57 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -146,8 +146,8 @@ pub fn check(build: &mut Build) { } } None => { - panic!("when targeting MUSL either the build.musl-root \ - option or the target.$TARGET.musl-root one must \ + panic!("when targeting MUSL either the rust.musl-root \ + option or the target.$TARGET.musl-root option must \ be specified in config.toml") } } |
