我正在尝试使用 Cabal 和 GHC 6.12.1 从 Hackage 安装nano-hmac-0.2.0包(我想要的包的依赖项),但它失败并出现以下错误:
Data/Digest/OpenSSL/HMAC.hsc:1:0:
Warning: Module `Prelude' is deprecated:
You are using the old package `base' version 3.x.
Future GHC versions will not support base version 3.x. You
should update your code to use the new base version 4.x.
<no location info>:
Failing due to -Werror.
果然,包的 .cabal 文件中有以下行:
ghc-options: -Wall -Werror -O2 -fvia-C
我希望能够覆盖该-Werror
选项,以便无需手动修改 .cabal 文件即可安装软件包,但找不到可行的方法。特别是,我尝试传递--ghc-options
给 Cabal 以将 a 粘贴-Wwarn
到 GHC 的参数列表中,如下所示:
$ cabal install nano-hmac-0.2.0 -v2 --ghc-options='-Wwarn'
但是,这不符合我的要求;详细输出验证它-Wwarn
被添加到 GHC 参数列表的开头,但-Werror
来自 .cabal 文件的 .cabal 文件稍后出现并且似乎覆盖了它:
/usr/bin/ghc -Wwarn --make -package-name nano-hmac-0.2.0 -hide-all-packages -fbuilding-cabal-package -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -odir dist/build -hidir dist/build -stubdir dist/build -package-id base-3.0.3.2-0092f5a086872e0cdaf979254933cd43 -package-id bytestring-0.9.1.5-125aff5b9d19ec30231ae2684b8c8577 -O -Wall -Werror -O2 -fvia-C -XForeignFunctionInterface -XBangPatterns -XCPP Data.Digest.OpenSSL.HMAC
我还尝试传递--constraint='base >= 4'
给 Cabal 以强制它使用更新版本的 base 并完全避免警告,但我遇到了同样的失败,我仍然在详细输出中看到以下内容:
Dependency base ==3.0.3.2: using base-3.0.3.2
有没有办法通过 Cabal 命令行摆脱或覆盖-Werror
来自 .cabal 文件的内容,或者我是否坚持自己修改 .cabal 文件?