ghcup-hs icon indicating copy to clipboard operation
ghcup-hs copied to clipboard

Reconsider adding MSYS2's MinGW-w64 to extra-lib-dirs on Windows

Open hasufell opened this issue 1 year ago • 4 comments

In GitLab by @RyanGlScott on Sep 8, 2022, 22:22

Currently, the default behavior of the Windows bootstrap script is to add MSYS2's /mingw64/lib to the extra-lib-dirs in the generated cabal config file. (See this line). Unfortunately, this has a number of unfortunate consequences:

  1. Due to ghc/ghc#21111, pre-9.4 versions of GHC will break if LIBRARY_PATH includes the most recent version of the MinGW-w64 C runtime.
  2. Even on GHC 9.4, which doesn't suffer from ghc/ghc#21111, augmenting LIBRARY_PATH is the wrong choice, since GHC 9.4 ships a Clang-based toolchain instead of a MinGW-w64–based one. Since the ABI that Clang uses is different from what MinGW-w64 uses, libraries that are built with MinGW-w64 are often not compatible with Clang. A more correct thing to put on the LIBRARY_PATH would be /clang64/lib, but even then, that would only work for GHC 9.4 or later.

For these reasons, I propose that ghcup not add directories from MSYS2 to the extra-lib-dirs. I am aware that ghcup includes an option for disabling this behavior, but the default behavior is so likely to break that I think it the default ought to be changed.

hasufell avatar Sep 08 '22 14:09 hasufell