2013-12-15 60 views
0

我正在尝试安装c2hs与cabal install c2hs。 我创建了~/.cabal/bin以预先安装二进制文件。与Mac OS X的c2hs安装错误10.7.5

用命令cabal install c2hs得到错误。

src/Control/StateTrans.hs:77:1: Warning: 
    Module `Prelude' does not export `catch' 
[ 3 of 26] Compiling Data.Errors  (src/Data/Errors.hs, dist/build/c2hs/c2hs-tmp/Data/Errors.o) 
[ 4 of 26] Compiling Data.Attributes (src/Data/Attributes.hs, dist/build/c2hs/c2hs-tmp/Data/Attributes.o) 
[ 5 of 26] Compiling Text.Lexers  (src/Text/Lexers.hs, dist/build/c2hs/c2hs-tmp/Text/Lexers.o) 
[ 6 of 26] Compiling Control.StateBase (src/Control/StateBase.hs, dist/build/c2hs/c2hs-tmp/Control/StateBase.o) 
[ 7 of 26] Compiling Data.NameSpaces (src/Data/NameSpaces.hs, dist/build/c2hs/c2hs-tmp/Data/NameSpaces.o) 
[ 8 of 26] Compiling C2HS.C.Attrs  (src/C2HS/C/Attrs.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Attrs.o) 
[ 9 of 26] Compiling C2HS.C.Builtin (src/C2HS/C/Builtin.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Builtin.o) 
[10 of 26] Compiling Paths_c2hs  (dist/build/autogen/Paths_c2hs.hs, dist/build/c2hs/c2hs-tmp/Paths_c2hs.o) 

dist/build/autogen/Paths_c2hs.hs:21:13: Not in scope: `catch' 

dist/build/autogen/Paths_c2hs.hs:22:13: Not in scope: `catch' 

dist/build/autogen/Paths_c2hs.hs:23:14: Not in scope: `catch' 

dist/build/autogen/Paths_c2hs.hs:24:17: Not in scope: `catch' 
cabal: Error: some packages failed to install: 
c2hs-0.16.5 failed during the building phase. The exception was: 
ExitFailure 1 

安装有什么问题? ghc版本是7.6.3。

回答

0

的问题是我安装我的Mac上两个不同版本的GHC:一个从brew install ghchaskell platform其他。

我不得不安装最新版本的haskell平台,但在此之前我还需要卸载旧版本uninstall-hs only VERSIONbrew unistall ghc

重新安装最新的haskell平台后,编译工作正常。

其他方法可使用酿造brew install haskell-platform

1

我现在在我的Ubuntu盒子上为我工作,所以我可以肯定的说,现在每个人都不会损坏c2hs。

我想你可能有版本问题....尝试

cabal update 

,然后重试安装。

尤其─

功能Prelude.catch被转移到Control.Exception.catch最近,看到https://ghc.haskell.org/trac/ghc/ticket/4865。我下载了c2hs源代码(使用cabal unpack c2hs),并查看了Paths_c2hs.hs需要的头文件(这似乎是导入问题的文件)。这是进口部分contained-

import qualified Control.Exception as Exception 
import Data.Version (Version(..)) 
import System.Environment (getEnv) 
import Prelude 

(Paths_c2hs.hs是自动生成的,所以我只好先建立它)。

事实上,它使用Control.Exception。因为这是一个基地模块,你应该拥有它,并且可能只是过时/不匹配的软件包。 (事实上​​,我的文件的行号不匹配你的错误消息的行号上文这是我们正在使用不同版本的另一个迹象,我相信我的是最新的:))。

虽然我认为“阴谋更新”将解决这个问题,如果没有,尝试寻找这两个地方 -

  1. 不Control.Exception.catch存在于你的基本模块?只是尝试编译一个空的程序与虚设的参考来抓,像这个 -

    进口Control.Exception

    X =捕捉

    主要=未定义

  2. 请问您自动生成Paths_c2hs.hs指向正确的catch函数。只需使用cabal解包,配置和构建c2h,然后查看dist/build/autogen/Paths_c2hs.hs。 (你可能会在构建阶段遇到你的错误,但考虑到你上面显示的内容,它会在创建Paths_c2hs.hs之后发生)。