-
Notifications
You must be signed in to change notification settings - Fork 411
cross run and cross test failed with Bad EXE format for target x86_64-pc-windows-gnu #1637
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
Comments
I'm also now seeing this. I suspect it's related to a change made to the compiler in 1.86.0, as the last successful run for the CI job was April 2, the day before 1.86.0 released. Edit: I also see a similar question asked today on StackOverflow: https://stackoverflow.com/questions/79553416/can-no-more-cross-compile-using-cross-run |
I wonder if this is the same issue as initially posted. Anyway! we can do a bisect with rustc bisect, ill see if I have time this weekend to do that, otherwise id appreciate some help. That SO post looks like #1657 |
searched nightlies: from nightly-2025-01-03 to nightly-2025-02-15 bisected with cargo-bisect-rustc v0.6.9Host triple: x86_64-unknown-linux-gnu cargo install cross https://github.com/cross-rs/cross
cargo new cross-issue1637
cd cross-issue1637
echo '#!/usr/bin/env bash
export CROSS_CUSTOM_TOOLCHAIN=1
cross run --target x86_64-pc-windows-gnu
' > cross-run.sh
chmod +x cross-run.sh
cargo bisect-rustc --target x86_64-pc-windows-gnu --script cross-run.sh --start 1.85.0 --end 1.86.0 this is most likely rust-lang/rust#135790 , which matches up with release profile working but not dev profile Unsure if this is a regression in rust or that we're doing something wonky with wine. To me it looks like a rust regression so I'll submit an issue upstream |
The issue is most likely not due to rustc doing something wrong but wine misinterpreting the header (and/or debuginfo). To solve this, we should identify what changed syntatically in the binary after rust-lang/rust@99768c8 and then file a report to the wine maintainers To research this, I'd suggest loading a binary into ghidra or similar tool. As I mentioned, I can't specifically dedicate much time to this this week, one workaround should be to strip the binary (haven't tested this) |
It has been more or less confirmed that this is a cross issue and not wine, with the binaries created by cross failing on real windows. We probably need to update the gnu toolchain |
So I spent my evening poking exes with objdump and found that the outputs from cross have the ".debug_addr" section while cross-compiled exes from cargo do not. The big thing there is that the presence of ".debug_addr" indicates that split-debuginfo is getting turned on at some point, which should not happen. A failing exe outputs this line from WINE: This leads me to believe that something in the cross environment is flipping rustc over to the msvc defaults instead of the proper windows-gnu settings. Edit: A little extra confirmation - running cross with the 1.85.1 toolchain does not generate the .debug_addr section. |
Recently there was another report to the upstream: rust-lang/rust#141096 And finding out the same error was caused by the old toolchain rang a bell for me. Looking at #1667, the toolchain appears to be at least 5 years old, so this is probably one of many Binutils bugs. Either updating the toolchain or using LLD would solve that problem.
Oh, I didn't see that before. Is it the only outstanding difference? |
Their release notes don’t mention it, but I can check the git history later. |
Please see the regression search here: #1637 (comment) |
Uh oh!
There was an error while loading. Please reload this page.
oh, why?
then I also tried
cargo run
:The text was updated successfully, but these errors were encountered: