2

安装完 hugs 然后安装 ghc6 然后安装 generic-haskell 有以下信息,怎么办?

# make package
Creating generic-haskell package ...
ghc-pkg: cannot find package generic-haskell
Reading package info from "generic-haskell.cabal.pkg" ... done.
generic-haskell-1.80: missing id field
generic-haskell-1.80: dependency "base-4.2.0.0" doesn't exist (use --force to override)
generic-haskell-1.80: dependency "haskell98-1.0.1.1" doesn't exist (use --force to override)
generic-haskell-1.80: dependency "containers-0.3.0.0" doesn't exist (use --force to override)
make: *** [package] Error 1

在 ubuntu 我编译 ghc-6.2.2 得到以下错误

/usr/bin/ghc -M -optdep-f -optdep.depend  -osuf o    -H16m -O HaskTags.hs

on the commandline:

    Warning: -optdep-f is deprecated: Use -dep-makefile instead
------------------------------------------------------------------------
==fptools== make boot - --no-print-directory -r;
 in /home/martin/ghc-6.2.2/ghc/utils/ghc-pkg
------------------------------------------------------------------------
/usr/bin/ghc -M -optdep-f -optdep.depend  -osuf o    -H16m -O -cpp -DPKG_TOOL -DWANT_PRETTY Main.hs Package.hs ParsePkgConfLite.hs Version.hs

on the commandline:
    Warning: -optdep-f is deprecated: Use -dep-makefile instead
make all
/usr/bin/ghc -H16m -O -cpp -DPKG_TOOL -DWANT_PRETTY    -c Main.hs -o Main.o  -ohi Main.hi

Main.hs:496:11:
    Ambiguous type variable `e' in the constraint:
      `Exception.Exception e'
        arising from a use of `Exception.throw' at Main.hs:496:11-25
    Possible cause: the monomorphism restriction applied to the following:
      my_catch :: forall a. IO a -> (e -> IO a) -> IO a
        (bound at Main.hs:499:0)
      my_throw :: forall a. e -> a (bound at Main.hs:496:0)
    Probable fix: give these definition(s) an explicit type signature
                  or use -XNoMonomorphismRestriction

Main.hs:498:13:
    Ambiguous type variable `e1' in the constraint:
      `Exception.Exception e1'
        arising from a use of `Exception.catch' at Main.hs:498:13-27
    Possible cause: the monomorphism restriction applied to the following:
      eval_catch :: forall a. a -> (e1 -> IO a) -> IO a
        (bound at Main.hs:498:0)
    Probable fix: give these definition(s) an explicit type signature
                  or use -XNoMonomorphismRestriction
make[4]: *** [Main.o] Error 1
make[3]: *** [boot] Error 2
make[2]: *** [boot] Error 1
make[1]: *** [boot] Error 1

有人在 ubuntu 10 中安装了旧版本的 GHC 和通用 haskell 吗?

有很多对版本,我试过 ghc-6.2.2 出现上述错误,我是否需要卸载 ubuntu 10 才能安装旧版本的 ubuntu 才能正常工作?哪个版本的 ubuntu 适用于哪个版本的 ghc? http://www.cs.uu.nl/research/projects/generic-haskell/compiler.html

4

2 回答 2

1

显然,该generic-haskell软件包依赖于旧版本的base.

Haskell 平台指定 base-4.3.1.0,而generic-haskell 需要旧版本。请联系维护人员,或者可能安装旧版本的 GHC。

于 2011-04-21T06:31:45.583 回答
1

我尝试从源代码自己安装 generic-haskell,我管理,并且能够描述我是如何修复它的。我的安装平台是 Haskell Platform 2011.2.0.1-x86_64,但是下面的说明比较笼统一些。

我遇到了三个问题,包括您描述的第一个问题(下面的第 3 个)。对于其他用户,我还描述了前两个,您可能也解决了。

1) 其他用户必须首先根据Data.Map.lookup类型更改来修复错误,对于containers>= 0.2.0.0:它曾经返回Monad m => m b(in containers-1.0.0.0),现在它只返回Maybe b. 我添加了调用来Data.Maybe.maybeToList修复一些需要使用列表类型的调用站点;我打赌你以某种方式修复了同样的错误。您可以在以下网址找到此修复: http ://hpaste.org/47624 。

2)我在 GHC 7 中遇到的另一个错误是配置脚本没有意识到它比 GHC 6.8 更新,因此它还需要依赖容器。配置输出包括这一行:

检查基础包是否被拆分(GHC 6.8 或更新版本)...否

要解决此问题,您需要更换

if test $ghc_ma -ge 6 -a $ghc_mi -ge 8; then

if test $ghc_ma -eq 6 -a $ghc_mi -ge 8 -o $ghc_ma -ge 7; then

3)要解决您的问题,您需要进行编辑build/generic-haskell.cabal.pkg(假设您没有使用 make in-place 进行就地安装)。您需要添加一个 id: 行并修复依赖行以使用系统上存在的包的包 ID 而不是包名称。您可以使用以下命令(包括我的系统上的输出)找出这些 ID:

$ ghc-pkg field base id
id: base-4.3.1.0-f5c465200a37a65ca26c5c6c600f6c76
$ ghc-pkg field haskell98 id
id: haskell98-1.1.0.1-150131ea75216886448a7146c9e0526b
$ ghc-pkg field containers id
id: containers-0.4.0.0-b4885363abca642443ccd842502a3b7e

然后更改为build/generic-haskell.cabal.pkg

-depends:        base-4.3.1.0
-                haskell98-1.1.0.1
-                containers-0.4.0.0
+depends:        base-4.3.1.0-f5c465200a37a65ca26c5c6c600f6c76
+                haskell98-1.1.0.1-150131ea75216886448a7146c9e0526b
+                containers-0.4.0.0-b4885363abca642443ccd842502a3b7e

此外,您需要在同一个文件中添加一个 id 行 - 只要您在重新安装库时更改它,任何 id 都可以。我在这里使用过:

id:             generic-haskell-1.80-lib-md5sum-2a7ae9d60440627618ad0b0139ef090b

I've also aligned all fields with spaces, as in the existing files. The syntax reference for this file can be found in: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/packages.html#installed-pkg-info

于 2011-06-09T17:14:37.127 回答