Skip to content

cross run and cross test failed with Bad EXE format for target x86_64-pc-windows-gnu #1637

Open
@eareimu

Description

@eareimu
reimu@ea ~/code> cargo new --lib syt; cd syt
reimu@ea ~/c/syt (main)> cross test  --target=x86_64-pc-windows-gnu
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'

  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.87.0-nightly (b74da9613 2025-03-06)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
   Compiling syt v0.1.0 (/home/reimu/code/syt)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.07s
     Running unittests src/lib.rs (/target/x86_64-pc-windows-gnu/debug/deps/syt-b5735c119cfe9f2a.exe)
wine: failed to start L"Z:\\target\\x86_64-pc-windows-gnu\\debug\\deps\\syt-b5735c119cfe9f2a.exe"
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Bad EXE format for Z:\target\x86_64-pc-windows-gnu\debug\deps\syt-b5735c119cfe9f2a.exe.

error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `env -u CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER wine /target/x86_64-pc-windows-gnu/debug/deps/syt-b5735c119cfe9f2a.exe` (exit status: 1)
note: test exited abnormally; to see the full output pass --nocapture to the harness.

oh, why?

then I also tried cargo run:

reimu@ea ~/c/syt (main) [1]> cd ..
reimu@ea ~/code> cargo new --bin syt1;cd syt1
    Creating binary (application) `syt1` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
reimu@ea ~/c/syt1 (main)> cross run  --target=x86_64-pc-windows-gnu
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'

  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.87.0-nightly (b74da9613 2025-03-06)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
   Compiling syt1 v0.1.0 (/home/reimu/code/syt1)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
     Running `env -u CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER wine /target/x86_64-pc-windows-gnu/debug/syt1.exe`
wine: failed to start L"Z:\\target\\x86_64-pc-windows-gnu\\debug\\syt1.exe"
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Bad EXE format for Z:\target\x86_64-pc-windows-gnu\debug\syt1.exe.

reimu@ea ~/c/syt1 (main) [1]> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-windowsArea: windows targets

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions