微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Windows 上的 Cabal来自 Chocolatey不使用库构建项目

如何解决Windows 上的 Cabal来自 Chocolatey不使用库构建项目

我在构建一个带有库的项目时遇到问题,使用 cabal 安装了 haskell-dev,在 windows 上使用 Chocolatey(即推荐的方法,开箱即用)。我最初认为该问题与我的特定项目有关,但实际上只需使用

创建模板项目即可轻松重现
cabal init --libandexe
cabal configure

然后 cabal build 无法构建并出现以下错误

cabal.exe: Failed to build testcabal1-0.1.0.0 (which is required by
exe:testcabal1 from testcabal1-0.1.0.0). The failure occurred during the final
install step. The exception was:
dieVerbatim: user error (cabal.exe:
'C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.10.2\bin\ghc-pkg.exe' exited
with an error:
testcabal1-0.1.0.0: Warning: library-dirs: C:\Program doesn't exist or isn't a
directory
testcabal1-0.1.0.0: Warning: dynamic-library-dirs: C:\Program doesn't exist or
isn't a directory
testcabal1-0.1.0.0: Warning: haddock-interfaces:
C:\projects\haskell\testcabal1\dist-newstyle\build\x86_64-windows\ghc-8.10.2\testcabal1-0.1.0.0\doc\html\testcabal1\testcabal1.haddock
doesn't exist or isn't a file
testcabal1-0.1.0.0: Warning: haddock-html:
C:\projects\haskell\testcabal1\dist-newstyle\build\x86_64-windows\ghc-8.10.2\testcabal1-0.1.0.0\doc\html\testcabal1
doesn't exist or isn't a directory
testcabal1-0.1.0.0: library-dirs: Files\Haskell is a relative path which makes
no sense (as there is nothing for it to be relative to). You can make paths
relative to the package database itself by using ${pkgroot}. (use --force to
override)
testcabal1-0.1.0.0: library-dirs: Platform\8.6.5\mingw\lib is a relative path
which makes no sense (as there is nothing for it to be relative to). You can
make paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
testcabal1-0.1.0.0: dynamic-library-dirs: Files\Haskell is a relative path
which makes no sense (as there is nothing for it to be relative to). You can
make paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
testcabal1-0.1.0.0: dynamic-library-dirs: Platform\8.6.5\mingw\lib is a
relative path which makes no sense (as there is nothing for it to be relative
to). You can make paths relative to the package database itself by using
${pkgroot}. (use --force to override)
)

这似乎与某些目录名称中的空格有关,其中 cabal / ghc 是由 Chocolatey 安装的?有什么想法吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。