Problems using Stack in a MSYS2 shell
Haskell Community [Unofficial]
April 19, 2026
The ‘temporary’ ghc<hash>.exe files are created by GHC itself. (For some reason, GHC does not clean them up (at least, not on Windows).)
I don’t know why anything would be trying to access C:\WINDOWS\Temp on your machine. On my machine, in PowerShell (TMP is the same):
> dir Env:TEMP
Name Value
---- -----
TEMP C:\Users\mike\AppData\Local\Temp
and in the Stack-supplied MSYS2 shell (extracts only):
$ env
...
MSYSTEM=MSYS
...
ORIGINAL_TEMP=/c/Users/mike/AppData/Local/Temp
...
STACK_ROOT=D:\sr
...
TEMP=/tmp
...
ORIGINAL_TMP=/c/Users/mike/AppData/Local/Temp
...
GHCUP_MSYS2_ENV=MINGW64
...
TMP=/tmp
...
GHCUP_MSYS2=D:\sr\programs\x86_64-windows\msys2-20240727
...
where the ‘actual’ path for / is:
$ cygpath -w /
D:\sr\programs\x86_64-windows\msys2-20240727\
Extra verbosity might reveal something. For full-fat verbosity (Stack’s, Cabal’s and GHC’s), command:
stack --verbose build --cabal-verbose --ghc-options=-v turtle
(EDIT: --ghc-options=-v4 is probably too verbose.)
Discussion in the ATmosphere