easier install instructions, using openblas

This commit is contained in:
sheaf 2020-09-08 15:21:32 +02:00
parent b608bed8b0
commit 07c789ccc3
2 changed files with 41 additions and 18 deletions

View file

@ -22,6 +22,7 @@ source-repository-package
package hmatrix
ghc-options: "-w"
flags: +openblas
-- adds MonadTrans Decoder instance to waargonaut Decoder
source-repository-package

View file

@ -12,10 +12,11 @@ With an `MSYS2` installation, the following environment variables will need to b
`PKG_CONFIG_PATH`: `C:\msys64\mingw64\lib\pkgconfig`
`XDG_DATA_DIRS`: `C:\msys64\mingw64\share;C:\msys64\usr\share`
Then we install some necessary packages using the following command:
```bash
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-gtksourceview3
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-gtksourceview3 mingw64/mingw-w64-x86_64-openblas
```
## Possible errors
@ -62,10 +63,25 @@ Any error of the form:
include-dirs: /mingw64/bin is a relative path which makes no sense
```
indicates that one of the packages is incorrectly using a Unix-style path.
This was the case with `fontconfig`, which was resolved in [this patch](https://github.com/msys2/MINGW-packages/issues/872).
indicates that one of the packages is incorrectly configured with a Unix-style path.
At the time of writing, another dependency suffers from the same issue: `graphite2`. To fix this, change its `pkg-config` package file `graphite2.pc` as follows:
The version of `pkg-config` packaged with MSYS2 should automatically convert into the correct full filepaths.
So you might need to uninstall the currently installed `pkg-config`, and install the `MSYS2` one:
```
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config
```
This should fix the issue. Another solution is to pass the `--force` flag to `ghc-pkg` for the problematic packages.
At the time of writing, the only dependency which presents this problem is `graphite2`, which is a dependency of `cairo`.
This causes a problem with the `gi-cairo-render` library, so in the `cabal.project` file we can specify:
```
package gi-cairo-render
ghc-pkg-options: "--force"
```
We can otherwise manually fix this issue by changing the `pkg-config` package file `graphite2.pc` as follows:
```
>>> before:
@ -77,33 +93,35 @@ Libs: -L${libdir} -lgraphite2
Cflags: -I${includedir}
```
### Missing C library `blas` or `lapack`
The package `fontconfig` also presented this issue; this was resolved in [this patch](https://github.com/msys2/MINGW-packages/issues/872).
### Missing C library `openblas`
The error message
```
Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: blas, lapack
* Missing (or bad) C library: openblas
```
indicates that `cabal` could not find the C libraries that `hmatrix` depends on.
indicates that `cabal` could not find a C library that `hmatrix` depends on.
These can be downloaded [here](https://icl.cs.utk.edu/lapack-for-windows/lapack/). You will need:
Make sure that `openblas` is installed:
* `BLAS` x64 dll,
* `LAPACK` x64 dll,
```
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-openblas
```
Put these in some folder, say "C:/GSL", then:
* add the folder to the PATH environment variable,
* add the following to your `cabal.project` file:
then ensure that `cabal` can find it, for instance:
```
package hmatrix
extra-lib-dirs: "C:/GSL"
extra-include-dirs: "C:/GSL"
extra-lib-dirs: "C:/msys64/mingw64/bin"
extra-include-dirs: "C:/msys64/mingw64/include"
```
enables `cabal` to find `C:/msys64/mingw64/bin/libopenblas.dll`.
### The code execution cannot proceed because libgfortran_64-3.dll was not found
An error such as
@ -118,14 +136,18 @@ or
The code execution cannot proceed because libgcc_s_seh_64-1.dll was not found
```
indicates that a dependency of `BLAS`/`LAPACK` could not be loaded. Download these DLLs and add them to the `PATH`.
indicates that a dependency of `BLAS` could not be loaded. These should have been installed as dependencies of `openblas` (see previous error), but otherwise you can try:
```
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-gcc-fortran mingw64/mingw-w64-x86_64-gcc
```
### addDLL: library not loaded
The error message
```
addDLL: C:\GSL\libblas or dependencies not loaded. (Win32 error 126)
addDLL: libopenblas or dependencies not loaded. (Win32 error 126)
```
means that `GHC` was not able to find the `BLAS` library, or a dependency thereof.