如何在Windows下使用BLAS和LAPACK构建hmatrix? [英] How to build hmatrix with BLAS and LAPACK under Windows?

查看:248
本文介绍了如何在Windows下使用BLAS和LAPACK构建hmatrix?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 10 x64
Cabal 1.22



我遵循Windows部分中的步骤 https://github.com/AlbertoRuiz/hmatrix/blob/master/INSTALL.md



我下载了hmatrix资源和gsl-lapack-windows.zip。
当我尝试安装hmatrix时:


\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 \

我得到了这个消息,我仍然无法解决:


配置hmatrix-0.16.1.5 ...无法安装hmatrix-0.16.1.5
生成日志(
D:\Projects\workspace\\ \\ matrix-0.16.1.5.cabal-sandbox \logs\hmatrix-0.16.1.5.log
):配置hmatrix-0.16.1.5 ...
setup-Simple-Cabal-1.22.4.0 -x86_64-windows-ghc-7.10.2.exe:缺少
依赖于外部库:
*缺少C库:blas,lapack,blas,lapack通常可以通过安装系统软件包来解决此问题提供这些
库(您可能需要-dev版本)。如果库已经安装了
,但是在非标准位置,那么您可以使用
标志--extra-include-dirs =和--extra-lib-dirs =指定$ b $他们是。 cabal:错误:某些软件包安装失败:在配置步骤中
hmatrix-0.16.1.5失败。例外是:
ExitFailure 1


- dev versions我认为只适用于基于* nix的操作系统。在我给cabal的文件夹中有blas.dll和lapack.dll。



可能是什么问题?

解决方案

试试这个:


  1. https://sourceforge.net/projects/mingw-w64/files/ ,在我的情况下 x86_64 -posix-SEH )。我们只需要 libgfortran-3.dll ,它不存在于ghc的mingw中。或者你可以从这里得到它: http://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.6.0/Dynamic-MINGW/Win64/libgfortran-3.dll (如果需要,用Win32替换Win64)

  2. https://sourceforge.net/projects/openblas/files/ (在我的例子中是 Win64-int32 )。

  3. 在某些文件夹中放置 libopenblas.dll libgfortran-3.dll ,在我的情况下 C:\Programs\lib

  4. cabal install hmatrix --flags = openblas --extra-lib-dirs = C :\Programs\lib

就是这样。你还必须将libs传递给 ghci (所有库都必须在PATH中,所以在我的例子中ghc的 mingw \bin C:\Programs\lib 位于PATH中):

ghci -llibopenblas -llibgfortran-3 -llibgcc_s_seh-1



其中 libgcc_s_seh-1.dll 是在ghc的mingw(在我的情况下: C:\Programs\ghc\ghc-8.0.1\mingw\bin



注意:使用ghc-8.0.1测试

更新:我发现现在可以少做步骤


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?

解决方案

Try this:

  1. Install mingw from https://sourceforge.net/projects/mingw-w64/files/, in my case x86_64-posix-seh). We need just libgfortran-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)
  2. Get OpenBLAS binaries from https://sourceforge.net/projects/openblas/files/ (in my case Win64-int32).
  3. Place libopenblas.dll and libgfortran-3.dll in some folder, in my case C:\Programs\lib
  4. 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

这篇关于如何在Windows下使用BLAS和LAPACK构建hmatrix?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆