ghc.exe: Could not load `libwinpthread-1.dll - Windows issue
Summary
I want to preface this by saying I'm aware of two similar issues, both of which have been closed without resolution: #17319 (closed) #17318 (closed)
I believe mine is slightly different (the submitter of the previous issues was experiencing a different error code), which is why I'm writing a new report.
When I attempt to install a package that has a dependency requiring libwinpthread-1.dll, the installation fails with the following error:
shake > ghc.exe: panic! (the 'impossible' happened)
shake > (GHC version 8.8.3 for x86_64-unknown-mingw32):
shake > loadArchive "C:\\Users\\Joel\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-8.8.3\\mingw\\x86_64-w64-mingw32\\lib\\libpthread.dll.a": failed
shake >
shake > Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
shake >
shake > ghc.exe: Could not load `libwinpthread-1.dll'. Reason: addDLL: libwinpthread-1.dll or dependencies not loaded. (Win32 error 1920)
It appears it can't find the required file (error 1920 is "The file cannot be accessed by the system."). I've looked at the folder reported there, and libpthread.dll.a exists. I've attempted to fix the issue by using stack's pacman installation to add msys2 packages that provide libwinpthread, but it has not changed anything.
Steps to reproduce
- On Windows, create a new project via stack:
stack new test
- Update the dependencies in package.yaml to include either
shake
ormath-functions
. I did not specify a version number, but it appears to be using 0.18.5 for shake, and 0.3.3.0 for math-functions. - Run
stack install
. It will run the build process and fail on one of the build steps (In my case,Development.Shake.Internal.Paths
or Numeric.Sum)
Expected behavior
Everything compiles normally.
Environment
- GHC version used: 8.8.3, installed via Stack
Optional:
- Operating System: Windows 10 Pro, 10.0.18362 Build 18362
- System Architecture: x64