The guessed output file should have ".exe" extension on Windows. ld tends to
add .exe automatically if the output file doesn't have extension but if
we don't add the extension explicitly then the doesFileExists check in
DriverPipeline.link will fail.
let isMain = (== mainModIs dflags) . ms_mod
[ms] <- return (filter isMain mod_graph)
ml_hs_file (ms_location ms)
+#if defined(mingw32_HOST_OS)
+ guessedName = fmap (\fname -> basenameOf fname `joinFileExt` "exe") mainModuleSrcPath
+#else
guessedName = fmap basenameOf mainModuleSrcPath
+#endif
in
case outputFile dflags of
Just _ -> env