From 07c789ccc3e207f6e9d6e717e34f0a16255343af Mon Sep 17 00:00:00 2001 From: sheaf Date: Tue, 8 Sep 2020 15:21:32 +0200 Subject: [PATCH] easier install instructions, using openblas --- cabal.project | 1 + installation_notes.md | 58 +++++++++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/cabal.project b/cabal.project index 97d114c..8bf8a5f 100644 --- a/cabal.project +++ b/cabal.project @@ -22,6 +22,7 @@ source-repository-package package hmatrix ghc-options: "-w" + flags: +openblas -- adds MonadTrans Decoder instance to waargonaut Decoder source-repository-package diff --git a/installation_notes.md b/installation_notes.md index 6639a39..9a6f466 100644 --- a/installation_notes.md +++ b/installation_notes.md @@ -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.