-
Notifications
You must be signed in to change notification settings - Fork 248
Regression when reading files via TH in windows (ucrt64
) cross compilation on GHC 9.6/9.8/9.10
#2361
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
Comments
ucrt64
) cross compilation
ucrt64
) cross compilationucrt64
) cross compilation on GHC 9.6
ucrt64
) cross compilation on GHC 9.6ucrt64
) cross compilation on GHC 9.6/9.8/9.10
See also #2314 |
@amesgen thanks for the report. I remember seeing this ...
iirc this was due to mixing msvcrt and ucrt runtimes somewhere. |
This is proving hard to track down. Just adding A
However it seems that NixOS/nixpkgs@41d3086 is not related to the TH failure. It just forces everything to be rebuilt (it changes It seems like the success/failure depends on something nondeterministic in the build output for the Here is a version of {-# LANGUAGE TemplateHaskell #-}
module Main where
import qualified Language.Haskell.TH.Syntax as TH
import GHC.IO.IOMode
import qualified GHC.IO.FD as FD
import GHC.IO.Device as IODevice
import Foreign
import Foreign.C.Types
main :: IO ()
main = putStrLn $(TH.lift =<< TH.runIO (do
putStrLn "HELLO"
(fd, _) <- FD.openFile "app/foo.txt" ReadMode True
-- IODevice.ready fd False 100 >>= print -- Works fine
ptr <- mallocBytes 100
x <- IODevice.read fd ptr 0 1 -- Fails here
print x
c <- peekArray x ptr
print c
return $ show c)) |
Uh oh!
There was an error while loading. Please reload this page.
Since #2354, reading files via TemplateHaskell for Windows cross-compilation (
ucrt64
;mingwW64
is broken before/after #2354) fails:This error occurs with GHC 9.6.7 and GHC 9.8.4 and 9.10.2; with 9.12.2, it seems to work fine.
Minimal reproducible example
https://github.com/amesgen/stuff/tree/haskell.nix-windows-TH-readFile
Running this command reproduces the bug, using haskell.nix at 008e8cc:
nix build github:amesgen/stuff/haskell.nix-windows-TH-readFile#bad
This command runs with haskell.nix at e985453, which works fine, demonstrating that #2354 introduced the regression:
nix build github:amesgen/stuff/haskell.nix-windows-TH-readFile#good
The text was updated successfully, but these errors were encountered: