-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Document cross compilation target == host bugfix. #6803
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
DO_NOT_USE_THIS
is kind of a red-flag that this probably isn't the right way to do this 😂I'm not sure I understand the use case here, what does it mean to cross-compile for a target with the same triple as the host?
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.
It's the correct way to do this on a stable rust toolchain, because the fix is behind a nightly flag and that's the only way to enable a nightly flag on the stable toolchain. By policy nightly flags are not supported/documented as available on stable toolchains but there's not actually a technical reason that they won't work(they work effectively the same as they do on a nightly toolchain if you set
__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly"
), this particular nightly only feature is needed to fix a critical cross compilation toolchain bug. I've been trying to stabilize this for a while but that's stalled for unclear reasons.For example if the host triple(ie
x86_64-unknown-linux-gnu
) is identical to the target triple(iex86_64-unknown-linux-gnu
) then you need to set this in the env when cross compiling otherwise the build will likely fail with cryptic build script linker errors due to cargo using the wrong linker for build scripts.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.
Why do you want to cross compile at all if the host triple is the target triple? Wouldn't you just compile it? I'm assuming there's a nuance I'm missing here 😄
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.
For example I'm trying to cross compile a rootfs image for an embedded
x86_64
board using buildroot.We can't compile on the target because the target does not have a compiler.
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.
We are currently using this fix with our infrastructure to build python-cryptography.
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.
(Apologies for not following up here more promptly.)
I guess the thing I don't understand is why this is considered cross-compilation at all? If the host and target are both "the same", what's being solved here?