问题描述
我正在尝试跟随 Plutus Pioneer 的讲座,但出现此错误 我的系统: 在 MacOS 上运行的 Ubuntu Linux Docker 映像。 我从这里在图像上安装了 Haskell 包:https://www.haskell.org/platform/linux.html
在我的 Dockerfile 中使用这一行:RUN apt-get install -y haskell-platform
这似乎安装了 Cabal 2.4 版。
当我克隆讲座的代码存储库时:https://github.com/input-output-hk/plutus-pioneer-program 然后转到 week01 目录并像讲座中一样尝试 cabal build
,我收到未找到依赖项的错误。第一个缺少的依赖项是“aeson”,如果我运行 cabal install aeson
,它似乎会安装。
后续构建尝试因依赖项“base”版本错误而失败。
然后我想如果我将 Cabal 更新到 3.4 版可能会有帮助,所以我尝试了 cabal install cabal-install
,但这也有错误:
Theexception was:ExitFailure (-9)
This may be due to an out-of-memory condition.
所以我又用谷歌搜索了一些并尝试了这个命令行:cabal install --ghc-options="+RTS -M600M" -j1 cabal-install
from here https://stackoverflow.com/a/46148345/52236
这似乎更进一步,但现在我遇到了这个错误:
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.5 for x86_64-unkNown-linux): heap overflow
如果有人知道如何解决这个问题,我们将不胜感激。我是否需要为我的 Docker Ubuntu 映像添加更多 RAM?它目前有 1.9GB 的内存和 1.7GB 的可用空间。 谢谢, 米
解决方法
我通过增加 RTS 参数来解决这个问题:
cabal install --ghc-options="+RTS -M1000M" -j1 cabal-install
好吧,实际上它编译了所有内容,但是 cabal --version
仍然说 2.4,而不是 3.4。也有这个警告:
Warning: could not create a symlink in /root/.cabal/bin for cabal because the
file exists there already but is not managed by cabal. You can create a
symlink for this executable manually if you wish. The executable file has been
installed at /root/.cabal/bin/cabal