-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustbuild: per target musl-root #36292
Conversation
config.toml now accepts a target.$TARGET.musl-root key that lets you override the "build" musl-root value, which is set via the --musl-root flag or via the build.musl-root key. With this change, it's now possible to compile std for several musl targets at once. Here's are the sample commands to do such thing: ``` $ configure \ --enable-rustbuild \ --target=x86_64-unknown-linux-musl,arm-unknown-linux-musleabi \ --musl-root=/musl/x86_64-unknown-linux-musl/ $ edit config.toml && tail config.toml [target.arm-unknown-linux-musleabi] musl-root = "/x-tools/arm-unknown-linux-musleabi/arm-unknown-linux-musleabi/sysroot/usr" $ make ```
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. |
match build.config.musl_root { | ||
Some(ref root) => { | ||
match build.config.target_config[target].musl_root.as_ref() | ||
.or(build.config.musl_root.as_ref()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this logic with .or
could be a helper method on Build
?
Nice! Could you also update |
(remove it from the documentation, that is) |
@alexcrichton addressed your comments |
⌛ Testing commit 8cfc69e with merge a7b2232... |
rustbuild: per target musl-root config.toml now accepts a target.$TARGET.musl-root key that lets you override the "build" musl-root value, which is set via the --musl-root flag or via the build.musl-root key. With this change, it's now possible to compile std for several musl targets at once. Here's are the sample commands to do such thing: ``` $ configure \ --enable-rustbuild \ --target=x86_64-unknown-linux-musl,arm-unknown-linux-musleabi \ --musl-root=/musl/x86_64-unknown-linux-musl/ $ edit config.toml && tail config.toml [target.arm-unknown-linux-musleabi] musl-root = "/x-tools/arm-unknown-linux-musleabi/arm-unknown-linux-musleabi/sysroot/usr" $ make ``` r? @alexcrichton With this we should be able to start producing releases of std for arm musl targets
In rust-lang#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 commit rectifies that and allows successful building of musl-based ARM targets.
…musl-root, r=alexcrichton Fix rustbuild per-target musl root In rust-lang#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.
config.toml now accepts a target.$TARGET.musl-root key that lets you
override the "build" musl-root value, which is set via the --musl-root
flag or via the build.musl-root key.
With this change, it's now possible to compile std for several musl
targets at once. Here's are the sample commands to do such thing:
r? @alexcrichton
With this we should be able to start producing releases of std for arm musl targets