无法安装json-.0.4.4 - 内存分配失败

时间:2012-11-20 18:16:41

标签: json haskell ghc cabal

我尝试在Mac OS 10.5.8上安装json-0.4.4软件包,并收到此错误:

$ sudo cabal install "json-0.4.4"
Building json-0.4.4...
[1 of 7] Compiling Text.JSON.Types  ( Text/JSON/Types.hs,
dist/build/Text/JSON/Types.o )
[2 of 7] Compiling Text.JSON.Pretty ( Text/JSON/Pretty.hs,
dist/build/Text/JSON/Pretty.o )
[3 of 7] Compiling Text.JSON.ReadP  ( Text/JSON/ReadP.hs,
dist/build/Text/JSON/ReadP.o )

Text/JSON/ReadP.hs:104:21:
    Warning: A do-notation statement discarded a result of type b.
             Suppress this warning by saying "_ <- n",
             or by using the flag -fno-warn-unused-do-bind
[4 of 7] Compiling Text.JSON.Parsec ( Text/JSON/Parsec.hs,
dist/build/Text/JSON/Parsec.o )
ghc: memory allocation failed (requested 2097152 bytes)
cabal: Error: some packages failed to install:
json-0.4.4 failed during the building phase. The exception was:
ExitFailure 1

这是在具有16GB RAM的计算机上。

我不认为 http://www.haskell.org/cabal/FAQ.html#cabal-goes-into-an-infinite-loop--runs-out-of-memory 适用,因为我使用的版本高于那里提到的版本:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3
$ cabal --version
cabal-install version 0.8.2
using version 1.8.0.6 of the Cabal library

为什么我没有安装最新版本的JSON包?

$ sudo cabal install json
Resolving dependencies...
cabal: dependencies conflict: base-3.0.3.2 requires syb ==0.1.0.2 however
syb-0.1.0.2 was excluded because json-0.7 requires syb >=0.3.3

更新基础IIUC将意味着更新我的整个Haskell平台安装,并且我已经拥有可用于Mac OS 10.5二进制文件的最新版本。我可以从源代码构建,或者使用port或brew,但我宁愿只使用json包构建。

我知道Mac OS 10.5.8已经过时了,但遗憾的是升级了这个 特定的机器不是一种选择。

1 个答案:

答案 0 :(得分:6)

它可能不是无限循环 - 由于内存简单,我安装(特别是具有有限RAM的VPS上的HSX)失败。我会尝试使用压缩收集器(它解决了我的问题):

sudo cabal install json-0.4.4 --ghc-options="+RTS -c -RTS"

如果即使失败了,您可以尝试使用-M设置堆大小(再次在RTS选项中),但我可以提供较少的帮助。