Build for x86_64-pc-windows-gnu
leads to "The specified executable is not a valid application for this OS"
#1677
Closed
4 of 11 tasks
Checklist
Describe your issue
Hi,
cross compiling from my Linux VM (Ubuntu) for my Windows machine does produce non-runnable executables in debug mode.
If I compile my executable (in this case just the
cargo init
hello world project) with this command:cross build --target x86_64-pc-windows-gnu
I get the following output when trying to run the built
.exe
on Windows:Interestingly, a binary produced by the command
cross build -r --target x86_64-pc-windows-gnu
runs as expected (prints hello world to the open PowerShell console).This means my program runs in release mode, but not in debug mode.
I am trying to run the executable in an open PowerShell console like this:
PS C:\Users\the\path\> .\history_versions.exe
I think I am using the correct target.
My PC has the processor
Intel(R) Core(TM) Ultra 7 165H 1.40 GHz
and the Windows "System Type" info box says (in German) "64-Bit-Betriebssystem, x64-basierter Prozessor".What target(s) are you cross-compiling for?
x86_64-pc-windows-gnu
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
cross 0.2.5 (9e2298e 2025-04-28)
Example
This produces a binary that does not work on my Windows machine.
This produces a binary that works on my Windows machine.
Additional information / notes
Both binaries are transferred using SCP on Windows (PowerShell):
scp user@ip:/path/history_versions/target/x86_64-pc-windows-gnu/release/history_versions.exe ./
The text was updated successfully, but these errors were encountered: