The matrix

I thought I had built the hmatrix package on Windows 10 version 2004, but that was a blue pill illusion. The red pill reality was more complex.

MSYS2

The Haskell Tool Stack comes with a version of MSYS2, in a folder of the folder returned by stack path --programs. Currently, that folder is msys2-20180531.

A MSYS2 terminal window can be opened by executing msys2_shell.cmd.

In principle, MSYS2 can be updated with the command pacman -Syu. Currently, updating was more complicated than that, due to keyring issues.

GHC

GHC on Windows also comes with certain MSYS2-built tools, in folder $tooldir\mingw\bin, where $tooldir is the GHC root folder. The tools include gcc.exe (the GNU Compiler Collection) and ld.exe (the GNU linker). GHC uses gcc by default for linking and gcc, in turn, uses ld as its default linker.

On Windows, when ld is called with the option -l namespec (the option that specifies the item to link) it will attempt to find, in order:

searching each folder in the search path in turn.

OpenBLAS

MSYS2 provides an OpenBLAS package, currently mingw-w64-x86_64-openblas version 0.3.10-2, which is up to date. It can be installed with pacman -S mingw-w64-x86_64-openblas.

GSL and GLPK

MSYS2 also provides a GSL (GNU Scientific Library) package and a GLPK (GNU Linear Programming Kit) package, currently mingw-w64-x86_64-gsl version 2.6-1 and mingw-w64-x86_64-glpk version 4.65-1 respectively. They can be installed with pacman -S mingw-w64-x86_64-gsl mingw-w64-x86_64-glpk.

hmatrix-0.20.0.0

The hmatrix.cabal for version 0.20.0.0 specifies:

However, the only dependency that seems to be necessary is on the OpenBLAS library. Tamar Christina’s post Why doesn’t GHCi on Windows find my DLL explains that the dependency should be on the import library and referenced by openblas. So, the hmatrix.cabal should specify:

This is fixed in commit 8d21370.

hmatrix-gsl-0.19.0.1

The hmatrix-gsl.cabal for version 0.19.0.1 specifies:

However, again, the dependency should be on the import library and referenced by gsl. So, the hmatrix-gsl.cabal should specify:

This is also fixed in commit 8d21370.

Build

After the fixes above, the packages of the hmatrix repository can be built with:

The resolver nightly-2020-07-29 specifies GHC 8.10.1. The repository will not build with GHC 8.8.3 (lts-16.7) because of a bug in GHC affecting Windows 10 version 2004.