Automating GHC build for Windows

Gintautas Miliauskas gintautas.miliauskas at
Mon Nov 3 00:24:54 UTC 2014

Without knowing much about the surrounding code, I would try two things

1. Is it possible that the file was opened by for writing and not closed
because of lazy I/O?

2. Since the error is completely deterministic, you could try "freezing"
evaluation right before the crash (either by a breakpoint in ghci or just
adding a time delay / console read on the code), and then using a utility
check which process is keeping the file open, whether it's the same process
or something else.

If any of the involved paths is a directory, this could be #8482
<>, although that does not seem
to be the case.

On Thu, Oct 30, 2014 at 7:13 PM, Páli Gábor János <pali.gabor at>

> 2014-10-30 16:24 GMT+01:00 Gintautas Miliauskas <gintautas at>:
> > I wonder what's going on with DeleteFile. What is the step that's
> failing?
> Basically it happens at the same point, that is, at the "configure"
> phase but at the ghc-prim package.  Note that the previously mentioned
> workaround has a "removeFile" action [1], I guess the failure of that
> triggers the DeleteFile exception.
> > Can you post the log?
> "inplace/bin/ghc-cabal.exe" configure libraries/ghc-prim dist-install
> "" --with-ghc="C:/msys64/home/ghc-builder/ghc/inplace/bin/ghc-stage1.exe"
> --with-ghc-pkg="C:/msys64/home/ghc-builder/ghc/inplace/bin/ghc-pkg.exe"
> --flag=include-ghc-prim --disable-library-for-ghci
> --enable-library-vanilla --enable-library-for-ghci
> --enable-library-profiling --disable-shared
> --configure-option=CFLAGS=" -U__i686 -march=i686 -fno-stack-protector
>  " --configure-option=LDFLAGS="   " --configure-option=CPPFLAGS="   "
> --gcc-options=" -U__i686 -march=i686 -fno-stack-protector       "
> --with-gcc="C:/msys64/home/ghc-builder/ghc/inplace/mingw/bin/gcc.exe"
> --with-ld="C:/msys64/home/ghc-builder/ghc/inplace/mingw/bin/ld.exe"
> --configure-option=--with-cc="C:/msys64/home/ghc-builder/ghc/inplace/mingw/bin/gcc.exe"
> --with-ar="/usr/bin/ar" --with-alex="/usr/local/bin/alex"
> --with-happy="/usr/local/bin/happy"
> Configuring ghc-prim-
> ghc-cabal.exe: DeleteFile "dist-install\\setup-config": permission
> denied (The process cannot access the file because it is being used by
> another process.)
> libraries/ghc-prim/ recipe for target
> 'libraries/ghc-prim/dist-install/' failed
> make[1]: *** [libraries/ghc-prim/dist-install/] Error 1
> Makefile:71: recipe for target 'all' failed
> > I also wonder why this issue is not arising on other Windows machines...
> As the comment in the workaround goes, it has a "Big fat hairy race
> condition".  Therefore I am inclined to believe that it may be a
> problem for other systems as well, but I am the most unfortunate one
> who hits this error with 100% probability :-)
> [1]

Gintautas Miliauskas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list