-
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
Conversation
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
0169011
to
1193956
Compare
|
||
.. code-block:: console | ||
|
||
__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" |
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.
The
DO_NOT_USE_THIS
is kind of a red-flag that this probably isn't the right way to do this 😂
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.
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?
For example if the host triple(ie x86_64-unknown-linux-gnu
) is identical to the target triple(ie x86_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.
Why do you want to cross compile at all if the host triple is the target triple?
For example I'm trying to cross compile a rootfs image for an embedded x86_64
board using buildroot.
Wouldn't you just compile it?
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?
Apologies for letting this sit around so long, but reading through this I'm still confused. Is this some unusual thing where you're cross compiling for another rust triple but both the host triple and the target triple have the same architecture? You're definitely an expert on cross compilation compared to us and I think it's useful for this project to have more help on cross compiling in the docs, but we need to understand it before we can merge it. 😄 |
Going to close this since it's been quiet for a month -- we're still happy to merge if you can help us understand the use case, so please leave a comment if you're interested! |
This fix is needed for example when cross compiling for a
x86_64
target from ax86_64
build host.