问题
Windows 10 x64 Cabal 1.22
I'm following steps in Windows section https://github.com/AlbertoRuiz/hmatrix/blob/master/INSTALL.md
I downloaded hmatrix sources and gsl-lapack-windows.zip. When I try to install hmatrix with:
D:\Projects\workspace\hmatrix-0.16.1.5>cabal install --extra-include-dirs=D:\Projects\workspace\gsl-lapack-windows\ --extra-lib-dirs=d:\Projects\workspace\gsl-lapack-windows\
I got this message that I'm still cannot solve:
Configuring hmatrix-0.16.1.5... Failed to install hmatrix-0.16.1.5 Build log ( D:\Projects\workspace\hmatrix-0.16.1.5.cabal-sandbox\logs\hmatrix-0.16.1.5.log ): Configuring hmatrix-0.16.1.5... setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe: Missing dependencies on foreign libraries: * Missing C libraries: blas, lapack, blas, lapack This problem can usually be solved by installing the system packages that provide these libraries (you may need the "-dev" versions). If the libraries are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are. cabal: Error: some packages failed to install: hmatrix-0.16.1.5 failed during the configure step. The exception was: ExitFailure 1
"-dev versions" I think is only for *nix based OSes. In folders I give to cabal there are blas.dll and lapack.dll.
What could be the problem?
回答1:
Try this:
- Install mingw from https://sourceforge.net/projects/mingw-w64/files/, in my case
x86_64-posix-seh
). We need justlibgfortran-3.dll
, which is not present in ghc's mingw. Or you can get it from here: http://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.6.0/Dynamic-MINGW/Win64/libgfortran-3.dll (Replace Win64 with Win32 in url if necessary) - Get OpenBLAS binaries from https://sourceforge.net/projects/openblas/files/ (in my case
Win64-int32
). - Place
libopenblas.dll
andlibgfortran-3.dll
in some folder, in my caseC:\Programs\lib
cabal install hmatrix --flags=openblas --extra-lib-dirs=C:\Programs\lib
That's all. You also have to pass libs to ghci
(all libs must be in PATH, so in my case ghc's mingw\bin
and C:\Programs\lib
are in PATH):
ghci -llibopenblas -llibgfortran-3 -llibgcc_s_seh-1
where libgcc_s_seh-1.dll
is in ghc's mingw (in my case: C:\Programs\ghc\ghc-8.0.1\mingw\bin
)
NOTE: tested with ghc-8.0.1
UPDATE: i've found that now it can be done in less steps
来源:https://stackoverflow.com/questions/32423225/how-to-build-hmatrix-with-blas-and-lapack-under-windows