首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Windows 10环境下使用hmatrix正确构建阴谋项目?

如何在Windows 10环境下使用hmatrix正确构建阴谋项目?
EN

Stack Overflow用户
提问于 2021-09-07 15:35:44
回答 1查看 199关注 0票数 2

使用Windows 10 64位,Cabal-3.4.0.0,ghc-8.10.7.我用命令OpenBLAS在MSYS2环境中安装了pacman -S mingw-w64-x86_64-openblas。,我成功地用命令安装了hmart-0.20.2。

代码语言:javascript
复制
cabal install --lib hmatrix --flags=openblas --extra-include-dirs="C:\\ghcup\\msys64\\mingw64\\include\\OpenBLAS" --extra-lib-dirs="C:\\ghcup\\msys64\\mingw64\\bin" --extra-lib-dirs="C:\\ghcup\\msys64\\mingw64\\lib"

我正在尝试使用Main使用cabal build cabalhmatrix构建简单的测试项目。

代码语言:javascript
复制
module Main where

import Numeric.LinearAlgebra

main :: IO ()
main = do
  putStrLn $ show $ vector [1,2,3] * vector [3,0,-2]

但现在我得到了产出

代码语言:javascript
复制
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- hmatrix-0.20.2 (lib) (requires build)
- cabalhmatrix-0.1.0.0 (exe:cabalhmatrix) (first run)
Starting     hmatrix-0.20.2 (lib)

Failed to build hmatrix-0.20.2. The failure occurred during the configure
step.
Build log (
C:\cabal\logs\ghc-8.10.7\hmatrix-0.20.2-6dd2e8f2795550e4dd624770ac98c326dacc0cac.log
):
Warning: hmatrix.cabal:21:28: Packages with 'cabal-version: 1.12' or later
should specify a specific version of the Cabal spec of the form
'cabal-version: x.y'. Use 'cabal-version: 1.18'.
Configuring library for hmatrix-0.20.2..
cabal-3.4.0.0.exe: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: 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.If
the library files do exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

cabal-3.4.0.0.exe: Failed to build hmatrix-0.20.2 (which is required by
exe:cabalhmatrix from cabalhmatrix-0.1.0.0). See the build log above for
details.

我该怎么做才能正确地构建这个包?我想我需要在编译过程中以某种方式将参数--flags=openblas --extra-include-dirs="C:\\ghcup\\msys64\\mingw64\\include\\OpenBLAS" --extra-lib-dirs="C:\\ghcup\\msys64\\mingw64\\bin" --extra-lib-dirs="C:\\ghcup\\msys64\\mingw64\\lib"传递给hmatrix,但不知道如何做到这一点。老实说,我不明白这些争论究竟是什么程序(阴谋、ghc、ghc或其他什么),以及为什么阴谋集团要再次安装hmatrix。我在"C:\cabal\store\ghc-8.10.7\hmatrix-0.20.2-e917eca0fc7690010007a19f4f2a3602d86df0f0"目录中看到了hmatrix。

创建的cabal.project文件:

代码语言:javascript
复制
packages: .

package hmatrix
  flags: +openblas
  extra-include-dirs: C:\\ghcup\\msys64\\mingw64\\include\\OpenBLAS
  extra-lib-dirs: C:\\ghcup\\msys64\\mingw64\\bin, C:\\ghcup\\msys64\\mingw64\\libenter code here

在向libopenblas.dll添加PATH位置之后,变量阴谋项目就开始工作了。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-07 15:49:36

即使存在--lib标志,通常最好在假定Cabal不安装库的情况下工作。永远不要安装一个库,而只是依赖它-和让Cabal安装,更新等,只要有必要。

但是你怎么能传递必要的旗帜呢?用

代码语言:javascript
复制
packages: .

package hmatrix
   flags: openblas
   extra-include-dirs: C:\\ghcup\\msys64\\mingw64\\include\\OpenBLAS
   ...

将该文件与cabalhmatrix.cabal一起放在您自己项目的工作目录中。然后,在该目录中运行cabal build将使用带有适当库等标志的hmatrix安装。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69091022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档