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 (将#修改为@)