2012-11-20 32 views
1

我嘗試安裝JSON-0.4.4軟件包在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將意味着更新我的整個哈斯克爾平臺安裝,我已經有一個針對的是Mac OS 10.5的二進制可用的最新版本。我可以從源代碼構建,或使用端口或brew,但我寧願只製作json包。

我知道Mac OS 10.5.8是舊的,但不幸的是升級此 特定的機器不是一個選項。

+0

我只想指出(也是已經提供的答案),這似乎並不是一個卡巴爾問題。這是ghc在編譯特定源文件時耗盡內存。 – kosmikus

回答

6

它可能不是一個無限循環 - 由於內存的簡單缺乏,我已安裝(特別是帶有有限RAM的VPS上的HSX)失敗。我會嘗試使用壓縮收集器(其中固定我的問題):

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

如果連失敗,你可以(裏面的RTS選項再次)嘗試設置與-M堆大小,但我可以提供幫助少接着就,隨即。

+0

恐怕這不起作用。同樣的錯誤。我在+ RTS和-RTS之間添加了-M4095M以將堆大小設置爲可用的最大值,但這並沒有改變任何內容。似乎沒有關係,我是否有壓實收集器。 –

+0

嗯。在那種情況下,我最好的建議是升級GHC。 GHC OS X安裝程序似乎依賴於10.7,但是您應該能夠使用您現有的安裝從源代碼安裝(我建議只使用7.4; 7.6很新,許多庫缺少兼容的標籤發佈)。 – isturdy

+0

工作!謝謝。 –