Skip to content

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

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

Open
ZyX-II opened this issue May 16, 2025 · 4 comments
Open
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.

Comments

@ZyX-II
Copy link

ZyX-II commented May 16, 2025

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.

@ZyX-II ZyX-II added the C-bug Category: This is a bug. label May 16, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 16, 2025
@jieyouxu jieyouxu added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label May 16, 2025
@ZyX-II
Copy link
Author

ZyX-II commented May 16, 2025

cargo bisect-rustc --host x86_64-pc-windows-gnu --without-cargo --start 1.85.1 --end 1.86.0 --preserve --verbose --script powershell -- .\test.ps1 with test.ps1 being

rustc build.rs
.\build.exe
if (-not $?) { exit 1 }

yielded

searched nightlies: from nightly-2025-01-03 to nightly-2025-02-15
regressed nightly: nightly-2025-01-24
searched commit range: 649b995...99768c8
regressed commit: 99768c8

which is exact same commit as in #139380.

@workingjubilee
Copy link
Member

That's odd, I could have sworn we tested these binaries were executable on Windows, given, you know, that's what a tier 1 target means... I suppose I was quite wrong.

@workingjubilee
Copy link
Member

Thank you, @mati865, for the correction in #139380 though it is quite worrisome.

@mati865
Copy link
Contributor

mati865 commented May 17, 2025

@ZyX-II do you have mingw-w64 based C toolchain in your PATH? More specifically do you have x86_64-w64-mingw32-gcc in your PATH?
If so, which version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.
Projects
None yet
Development

No branches or pull requests

5 participants