2

I am trying to setup hmatrix on my Windows 10 machine with GHC 8.0.2. I was following the answer here but when I try to build it says that it cannot find libgfortran-3.dll although I am sure I added it to the bin folder in the BLAS directory. My code is in here I run stack build and this is what I get:

hmatrix-0.18.0.0: configure
Progress: 1/2
--  While building package hmatrix-0.18.0.0 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack-work\dist\ca59d0ab configure "--with-ghc=C:\\Program Files\\Haskell Platform\\8.0.2\\bin\\ghc.EXE" "--with-ghc-pkg=C:\\Program Files\\Haskell Platform\\8.0.2\\bin\\ghc-pkg.EXE" --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\b201cfe6\pkgdb --package-db=D:\Haskell\networks\.stack-work\install\65995373\pkgdb --libdir=D:\Haskell\networks\.stack-work\install\65995373\lib --bindir=D:\Haskell\networks\.stack-work\install\65995373\bin --datadir=D:\Haskell\networks\.stack-work\install\65995373\share --libexecdir=D:\Haskell\networks\.stack-work\install\65995373\libexec --sysconfdir=D:\Haskell\networks\.stack-work\install\65995373\etc --docdir=D:\Haskell\networks\.stack-work\install\65995373\doc\hmatrix-0.18.0.0 --htmldir=D:\Haskell\networks\.stack-work\install\65995373\doc\hmatrix-0.18.0.0 --haddockdir=D:\Haskell\networks\.stack-work\install\65995373\doc\hmatrix-0.18.0.0 --dependency=array=array-0.5.1.1 --dependency=base=base-4.9.1.0 --dependency=binary=binary-0.8.3.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=deepseq=deepseq-1.4.2.0 --dependency=random=random-1.1-9tceXaeYIMZ4JrKq20Egog --dependency=split=split-0.2.3.1-FWyXC6nhV0H3AfM8IzrEFk --dependency=storable-complex=storable-complex-0.2.2-G9QzpmZTKvgKKVagrcRWdL --dependency=vector=vector-0.11.0.0-HhutbadagxHIONIkSRJEug -fopenblas --extra-include-dirs=C:\OpenBLAS-v0.2.19-Win64-int32\include --extra-include-dirs=C:\Users\Yotam\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C:\OpenBLAS-v0.2.19-Win64-int32\bin --extra-lib-dirs=C:\Users\Yotam\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib
    Process exited with code: ExitFailure 1
    Logs have been written to: D:\Haskell\networks\.stack-work\logs\hmatrix-0.18.0.0.log

    Configuring hmatrix-0.18.0.0...
    Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe: Missing dependency on a foreign
    library:
    * Missing C library: libgfortran-3
    This problem can usually be solved by installing the system package that
    provides this library (you may need the "-dev" version). If the library is
    already installed but in a non-standard location then you can use the flags
    --extra-include-dirs= and --extra-lib-dirs= to specify where it is.

D:\OpenBLAS-v0.2.19-Win64-int32\bin includes both libopenblas.dll and libgfortran-3.dll and the blas directory was taken from this url

Thanks for any help

Yotam Ohad
  • 322
  • 3
  • 12
  • Is that directory on your `PATH`? – liminalisht May 26 '17 at 01:22
  • No, but even when I add it to path the result is the same. – Yotam Ohad May 26 '17 at 05:21
  • I know I shouldn't say this, but... are you sure you want to use _`hmatrix` on Windows_? I dislike both individually, for somewhat unrelated reasons (`hmatrix` for its ugly Matlab-like interface, Windows for its closedness), and `hmatrix`' GSL basis makes it an obvious fit for GNU/Linux based systems. Though it certainly _should_ work on Windows too (like Octave does), it'll definitely be a lot easier to use it on Linux or else use a native Haskell alternative which Stack actually has control over, on Windows. (_Or_ on Linux...) What kind of linear algebra is it you need to do? – leftaroundabout May 26 '17 at 09:46
  • Well I am trying to use hnn which requires hmatrix, I might switch to another package but now I just want to know what happened more than I want it to work. About Windows, I have only one machine and I don't trust myself to do dual boot correctly. – Yotam Ohad May 26 '17 at 10:52
  • A possible other solution. It seems that we can remove the dependency on `libgfortran`, if we clone the package: https://gist.github.com/RyanGlScott/6a707536d6279e339909e43274ad66fc – Stéphane Laurent Jun 05 '17 at 19:02

1 Answers1

1

I've managed to install it as follows.

In yourpath\to\stack\x86_64-windows\msys2-20150512, open a msys2 shell by double-clicking on msys2_shell.bat.

In the shell, type:

pacman -S mingw-w64-x86_64-toolchain

Then add these "extra" in stack.yaml:

extra-include-dirs:
- yourpath\to\OpenBLAS\include
extra-lib-dirs:
- yourpath\to\OpenBLAS\lib
- yourpath\to\stack\x86_64-windows\msys2-20150512\usr\lib\gcc\x86_64-pc-msys\6.3.0
- yourpath\to\stack\x86_64-windows\msys2-20150512\mingw64\bin
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225