Skip to content

Can’t run binaries with debuginfo created by x86_64-pc-windows-gnu compiler when using gcc 7.1.0 #141096

Open
@ZyX-II

Description

@ZyX-II

I tried this code:

// In build.rs
fn main() {
}

with command (run in powershell console)

rustc +$ver-x86_64-pc-windows-gnu .\build.rs ; .\build.exe

I expected to see this happen: command silently exits.

Instead, this happened: starting with version 1.86 command exits with

Сбой выполнения программы build.exe: Указанный исполняемый файл не является действительным приложением для этой операционной системы.строка:1 знак:48
+ rustc +1.86-x86_64-pc-windows-gnu .\build.rs ; .\build.exe
+                                                ~~~~~~~~~~~.
строка:1 знак:48
+ rustc +1.86-x86_64-pc-windows-gnu .\build.rs ; .\build.exe
+                                                ~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

due to failure while running build.exe. (This message is powershell complaining about build.exe not being valid executable for this operating system.)

Meta

First failing version tried:

rustc +1.86-x86_64-pc-windows-gnu --version --verbose

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-pc-windows-gnu
release: 1.86.0
LLVM version: 19.1.7

Last failing version tried:

rustc +nightly-x86_64-pc-windows-gnu --version --verbose

rustc 1.89.0-nightly (d97326eab 2025-05-15)
binary: rustc
commit-hash: d97326eabfc3b2c33abcb08d6bc117aefa697cb7
commit-date: 2025-05-15
host: x86_64-pc-windows-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4

Last succeeding version tried:

rustc +1.85-x86_64-pc-windows-gnu --version --verbose

rustc 1.85.1 (4eb161250 2025-03-15)
binary: rustc
commit-hash: 4eb161250e340c8f48f66e2b929ef4a5bed7c181
commit-date: 2025-03-15
host: x86_64-pc-windows-gnu
release: 1.85.1
LLVM version: 19.1.7

Additional details

This looks like #139380, except that rustc is installed on the same machine which attempts to run executable. Used windows version is Windows 10 Pro 21H2 19044.1526.

If rustc command changes to rustc +$ver-x86_64-pc-windows-gnu -C strip=debuginfo .\build.rs everything is fine for both 1.86 and nightly. Issue is not present on x86_64-pc-windows-msvc target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions