Ghc produces invalid binaries on windows after msys2 update
Summary
After updating msys2 (using pacman -Syu
), ghc produces invalid binaries.
This also happens with a new installation using ghcup, since it automatically updates as well.
Interestingly, after running strip
on the produced binary it seems to be ok.
However, since I now get errors when cabal compiles dependencies for me, this is unfortunately not a workaround I can apply.
Steps to reproduce
- Create a file
hello.hs
main :: IO ()
main = putStrLn "Hello, world!"
- Compile it with ghc
ghc hello.hs
- Run the produced binary
./hello.exe
Expected behavior
The program gets executed and prints "Hello, world!".
Observed behaviour
I get the following (german, system language) error message:
Fehler beim Ausführen des Programms "hello.exe": Die angegebene ausführbare Datei ist keine gültige Anwendung für
diese Betriebssystemplattform.In Zeile:1 Zeichen:1
+ ./hello
+ ~~~~~~~.
In Zeile:1 Zeichen:1
+ ./hello
+ ~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
After stripping the binary, I can execute it without problems.
Environment
- GHC version used: 9.0.2, 8.10.7 (both installed via ghcup, same behaviour for both)
Optional:
- Operating System: Windows 10
- System Architecture: x86_64