Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARM MUSL targets #35060

Merged
merged 9 commits into from
Jul 31, 2016
Merged

Add ARM MUSL targets #35060

merged 9 commits into from
Jul 31, 2016

Conversation

japaric
Copy link
Member

@japaric japaric commented Jul 27, 2016

Rebase of #33189.

I tested this by producing a std for arm-unknown-linux-musleabi then I cross compiled Hello world to said target. Checked that the produced binary was statically linked and verified that the binary worked under QEMU.

This depends on rust-lang/libc#341. I'll have to update this PR after that libc PR is merged.

I'm also working on generating ARM musl cross toolchain via crosstool-ng. Once I verified those work, I'll send a PR to rust-buildbot.

r? @alexcrichton
cc @timonvo

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@@ -0,0 +1,72 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an exact copy of src/librustc_back/target/linux_musl_base.rs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it is! I'll remove it.

@alexcrichton
Copy link
Member

Looks great to me, thanks @japaric! I'll r+ once the libc PR has merged

@japaric
Copy link
Member Author

japaric commented Jul 27, 2016

Addressed comment about any and updated the libc submodule.

@bors: r=alexcrichton

@bors
Copy link
Contributor

bors commented Jul 27, 2016

📌 Commit 3b955b0 has been approved by alexcrichton

@japaric
Copy link
Member Author

japaric commented Jul 27, 2016

Once I verified those work, I'll send a PR to rust-buildbot.

See rust-lang-deprecated/rust-buildbot#109

@alexcrichton
Copy link
Member

@bors: rollup

assuming this isn't very platform-specific and green travis means it's good to go whenever

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 30, 2016
Add ARM MUSL targets

Rebase of rust-lang#33189.

I tested this by producing a std for `arm-unknown-linux-musleabi` then I cross compiled Hello world to said target. Checked that the produced binary was statically linked and verified that the binary worked under QEMU.

This depends on rust-lang/libc#341. I'll have to update this PR after that libc PR is merged.

I'm also working on generating ARM musl cross toolchain via crosstool-ng. Once I verified those work, I'll send a PR to rust-buildbot.

r? @alexcrichton
cc @timonvo
@cardoe
Copy link
Contributor

cardoe commented Jul 30, 2016

Any reason why the GNU Make files aren't being populated and we have to use the new build system to build these targets? We build these targets in Yocto and will likely have to patch this support in. https://github.com/meta-rust/meta-rust/blob/master/recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch


use target::Target;

pub fn target() -> Target {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to return TargetResult now.

timonvo and others added 9 commits July 30, 2016 15:39
This is to pull in changes to support ARM MUSL targets.

This change also commits a couple of other cargo-generated changes
to other dependencies in the various Cargo.toml files.
The targets are:
- `arm-unknown-linux-musleabi`
- `arm-unknown-linux-musleabihf`
- `armv7-unknown-linux-musleabihf`

These mirror the existing `gnueabi` targets.

All of these targets produce fully static binaries, similar to the
x86 MUSL targets.

For now these targets can only be used with `--rustbuild` builds, as
rust-lang/compiler-rt#22 only made the
necessary compiler-rt changes in the CMake configs, not the plain
GNU Make configs.

I've tested these targets GCC 5.3.0 compiled again musl-1.1.12
(downloaded from http://musl.codu.org/). An example `./configure`
invocation is:

```
./configure \
    --enable-rustbuild
    --target=arm-unknown-linux-musleabi \
    --musl-root="$MUSL_ROOT"
```

where `MUSL_ROOT` points to the `arm-linux-musleabi` prefix.
Usually that path will be of the form
`/foobar/arm-linux-musleabi/arm-linux-musleabi`.

Usually the cross-compile toolchain will live under
`/foobar/arm-linux-musleabi/bin`. That path should either by added
to your `PATH` variable, or you should add a section to your
`config.toml` as follows:

```
[target.arm-unknown-linux-musleabi]
cc = "/foobar/arm-linux-musleabi/bin/arm-linux-musleabi-gcc"
cxx = "/foobar/arm-linux-musleabi/bin/arm-linux-musleabi-g++"
```

As a prerequisite you'll also have to put a cross-compiled static
`libunwind.a` library in `$MUSL_ROOT/lib`. This is similar to [how
the x86_64 MUSL targets are built]
(https://doc.rust-lang.org/book/advanced-linking.html).
it's the same as linux_musl_base
@japaric
Copy link
Member Author

japaric commented Jul 30, 2016

This needs to return TargetResult now.

Thanks.

Any reason why the GNU Make files aren't being populated and we have to use the new build system to build these targets?

Probably it just hasn't been tested.

@bors r=alexcrichton rollup

@bors
Copy link
Contributor

bors commented Jul 30, 2016

📌 Commit eb61738 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jul 31, 2016

⌛ Testing commit eb61738 with merge 724f811...

bors added a commit that referenced this pull request Jul 31, 2016
Add ARM MUSL targets

Rebase of #33189.

I tested this by producing a std for `arm-unknown-linux-musleabi` then I cross compiled Hello world to said target. Checked that the produced binary was statically linked and verified that the binary worked under QEMU.

This depends on rust-lang/libc#341. I'll have to update this PR after that libc PR is merged.

I'm also working on generating ARM musl cross toolchain via crosstool-ng. Once I verified those work, I'll send a PR to rust-buildbot.

r? @alexcrichton
cc @timonvo
@bors bors merged commit eb61738 into rust-lang:master Jul 31, 2016
bors added a commit that referenced this pull request Aug 15, 2016
add GNU make files for arm-unknown-linux-musleabi

For Yocto (Embedded Linux meta distro) Rust is provided via the [meta-rust layer](https://github.com/meta-rust/meta-rust). In this project there have been patches to add `arm-unknown-linux-musleabi`. Rust recently acquired that support via #35060 but only for rustbuild. meta-rust is currently only able to build Rust support with the existing GNU Makefiles. This adds `arm-unknown-linux-musleabi` support to Rust for the GNU Makefiles until meta-rust is able to sort out why using rustbuild does not work for it.

/cc @srwalter @derekstraka @jmesmon @japaric
@japaric japaric deleted the arm-musl branch September 1, 2016 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants