-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 dynamically-linked musl targets #82556
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
r? @nagisa |
This comment has been minimized.
This comment has been minimized.
Build failure looks relevant. The docs entries have toolchain entries marked as being built, but I don't see any CI changes. Is there a reason those wouldn't be necessary? |
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.
The docs entries have toolchain entries marked as being built, but I don't see any CI changes. Is there a reason those wouldn't be necessary?
Yeah, I think the checkmarks should be removed from the new entries in platform-support.md
.
compiler/rustc_target/src/spec/armv6_unknown_linux_dynmusleabihf.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_target/src/spec/armv6_unknown_linux_dynmusleabihf.rs
Outdated
Show resolved
Hide resolved
5a43e69
to
479ad2e
Compare
I have already requested this over IRC, but for completeness sake, i686 dynmusl would complete the target matrix for Void Linux as well. |
…eabihf to align with other armv6 targets
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.
rustbuild also need to update as dynmusl
target don't need to ship rustlib/$target/lib/self-contained/*.o
.
compiler/rustc_target/src/spec/aarch64_unknown_linux_dynmusl.rs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
@petrochenkov we could change the default behavior and when detecting we are in a non-musl platform (the opposite check you linked to earlier) emit an unconditional warning letting you know that if you meant to build a statically compiled musl binary, to be explicit by passing |
I think what @estebank proposes makes the most sense. What would be involved in adding a warning for this? |
Note also that some build recipes are already broken with the current static-by-default behavior.
Here's an example: firefox requires its build scripts to be dynamically linked, but it uses I think everyone in the musl community would really just like to see this fixed using the standard toolchain names. It has been a huge barrier for people trying to use rust on musl-based systems for years now. |
This is exactly the kind of issue that I meant in
in #82556 (comment) (regardless of the musl specifics). |
☔ The latest upstream changes (presumably #82663) made this pull request unmergeable. Please resolve the merge conflicts. |
I agree that it should be easier to override target behaviour but in this case the default behaviour is completely broken for musl-based distributions, which should be the primary use case for a |
Wait, does setting |
If you pass |
Yes. This is the case where the application being compiled and build script being used to compile it have no reason to know anything about musl or that the target is musl-based, and they can't be expected to do anything to override the wrong default of static linking that might break what they're trying to do. If on the other hand youre trying to make static binaries using musl to distribute and run on systems where they're foreign, you're in the case where you're not just using a target fed to you as whatever the host default is, but working with a specific known system. In that case you can reasonably be expected to take care of your own target options. |
@rfcbot fcp cancel Given the discussion is ongoing and appears to have leaned towards an alternate approach, I'm going to cancel the FCP proposing the merge of this PR as it is written currently. |
@nagisa proposal cancelled. |
@kaniini just want to let you know that fcp cancellation is about the specifics of this PR's approach, given that there are multiple possible courses of action and we need to reach an agreement on which one to pursue. We still want to see this fixed in a way that everybody involved is happy with! |
Given this comment I'm removing also the "waiting on team" label for now. @rustbot label -S-waiting-on-team |
This is still waiting-on-team, the issue was nominated for discussion, but not discussed yet. Summary. |
@petrochenkov ah sorry then I have misunderstood the discussion from last week T-compiler meeting about this. Thanks for fixing! |
Hi everyone! We have a compiler team design meeting scheduled to discuss what to do to resolve this issue on March 26 10am EDT (14:00 UTC). Meetings are held in the |
The compiler team had a design team meeting and have proposed an MCP with an alternative solution to this problem: rust-lang/compiler-team#422 |
I think we can close this PR and focus on the other solution. |
This pull request adds
$arch-unknown-linux-dynmusl
targets as a generic replacement for Alpine's$arch-alpine-linux-musl
targets. The namedynmusl
was chosen based on discussion in rust-lang/rfcs#2695 and #59302.The platform support entries are based on the current state of the equivalent
$arch-alpine-linux-musl
targets.Rationale copied from down-thread...
The
dynmusl
targets are intended to provide a set of targets intended for use on dynamically-linked musl distros. They are intended to act the same as the glibc targets. Thedynmusl
targets are based on Alpine's previous set of targets which did the same thing (and review has found some deficiencies, thanks everyone!).I believe the
dynmusl
targets provide a compromise that is minimally intrusive to the rust compiler team, while providing musl-based distros like Alpine with a set of targets that meet their requirements. While not perfect (in an ideal world, the-musl
targets would not assume static linking and work like glibc), it does solve the problem in a way I believe we can all live with.These targets are required because Linux distributions generally consider static linking by default to be a policy violation. It is a policy violation in Alpine, Void and Adelie Linux, which are the top three musl-based distributions. Though it should also be said that there are staticly-linked musl distributions such as Sabotage, which would continue to be served by the
-musl
targets directly (if they ship Rust at all, I haven't checked).