-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor cross compile assistance #769
Conversation
This implementation draft factors in the host/env architecture when generating assistance help text and/or cargo environment variables for the target triple. It drops support for the `x86_64-linux-musl-gcc` binary name on macOS (safe to assume users have migrated and/or provide assistance for currently supported toolchain).
This should be moved to shared template. Instructions/required packages also needs to be tested further for each host OS (musl-tools and other packages may be required)
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.
Thanks for the PR! 🎉
I gave this a skim-read to provide some early feedback since this is one of your first PRs around here. I understand that this is a draft still.
Apart from the mostly minor code comments, I was missing some context due to the fact there is not PR description and the title being very vague (what does it fix, is there an existing issue somewhere?) Again, this is a draft PR and I write my descriptions at the very end as well. If that was to come later - ignore my comment! :)
There also seem to be some slight different in packages recommended. Have you verified those on the respective systems? For example, libc6-dev-arm64-cross
is no longer mentioned. It's possible it is not needed, but from the information I have it could also be an oversight. :)
Co-authored-by: Manuel Fuchs <[email protected]>
Improve readability by redeclaring the target_triple variable, retaining the relavant terminology
This will likely work without treating `musl-gcc` differently than other gcc_binaries, but requires further testing to ensure that's the case. The current implementation retains the logic prior to this pull request
No characters are used that would otherwise need escape
The help_text already includes a newline by the end
I previously removed libc6-dev-arm64-cross as it is installed by default (as a recommended package for the transient dependency) https://packages.ubuntu.com/jammy/gcc-11-aarch64-linux-gnu Adding it back to the help text as it is not a hard dependency (and won't be installed if the `--no-install-recommends` flag is set)
I have added a more elaborate description now with links to relevant issues. Merging this pull request should close those issues, but let me know if it's better to unlink them and manually close the issues with reference to this pull request! Should I perhaps add a CHANGELOG entry as well?
I initially removed the I'm not sure if |
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.
Thanks for the changes! Looking great! 👍🏻 Let's add a brief CHANGELOG
entry and ship it!
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.
Thank you for this! The implementation is both cleaner and more correct now :-)
I tested this manually locally on macOS by packaging the Python CNB (which includes C deps, such as ring
to exercise the env vars being set), in the following scenarios:
- the default target (
x86_64-unknown-linux-musl
) with and without the correct toolchain installed --target aarch64-unknown-linux-musl
with and without the correct toolchain installed
...and it worked great for all of those.
(Longer term we have #730 and #731 for exploring trying to test more scenarios in CI)
However, the binary used when the architectures don't match is still the *-gnu-gcc variant (as for instance aarch64-linux-musl-gcc is only available on aarch64 Linux (this requires further investigation, and a separate issue should be created for that)).
The intention of #724 was to be about the general case of "we probably shouldn't be using the non-MUSL gcc ever". This PR helps with a subset of cases, but not all (as you mentioned in the PR description). Rather than close #724 out, I've morphed the title to make it clearer that it's about the general case :-)
Co-authored-by: Ed Morley <[email protected]>
d71b6c5
to
f9fb1cf
Compare
We currently support targeting
x86_64-unknown-linux-musl
andaarch64-unknown-linux-musl
on macOS and Linux, but the cross compile assistance provided is inconsistent depending on the host's CPU architecture. This refactoring aims to improve that across all supportedtarget_triple
and host OS/architecture combinations by providing helpful assistance for supported scenarios.target_triple
relative to the current host OS and architecture.x86_64_unknown_linux_musl
from Linux #726 by adding support for targetingx86_64-unknown-linux-musl
from AARCH64 Linux.CXX_*
andAR_*
environment variables too #725).aarch64-unknown-linux-musl
from AARCH64 Linux. The gcc binary used when targeting the same architecture is nowmusl-gcc
on bothaarch64
andx86-64
.*-gnu-gcc
variant (as for instanceaarch64-linux-musl-gcc
is only available on aarch64 Linux (this requires further investigation, and a separate issue should be created for that)).aarch64-unknown-linux-musl
from aarch64 macOS.CrossCompileAssistance::Configuration
orCrossCompileAssistance::HelpText
is only returned when supported. OtherwiseCrossCompileAssistance::NoAssistance
is returned.It also:
x86_64-linux-musl-gcc
) installed by a previously recommended macOS toolchain. Since the current toolchain has been recommended for nearly 2 years it's probably safe to assume (or fair to require) that users have update to the recommended toolchain.The brew formula/revision has also been bumped, so the missing dependencies mentioned here Update cross-compile assistance for Apple silicon #312 (comment) are now included