Cabal包安装失败

时间:2013-11-30 22:44:05

标签: haskell cabal

我正在尝试在Windows环境中安装haskell HGL包。 这就是我得到的:

e:\Study\haskell>cabal install HGL
Resolving dependencies...
Configuring HGL-3.2.0.0...
Building HGL-3.2.0.0...
Preprocessing library HGL-3.2.0.0...

Graphics\HGL\Key.hs:57:8:
   Could not find module `Graphics.Win32'
   It is a member of the hidden package `Win32-2.3.0.0'.
   Perhaps you need to add `Win32' to the build-depends in your .cabal file.
   Use -v to see a list of the files searched for.
Failed to install HGL-3.2.0.0
cabal: Error: some packages failed to install:
HGL-3.2.0.0 failed during the building phase. The exception was:
ExitFailure 1

因为我对Haskell都不熟悉,谷歌搜索对我没什么帮助,请告诉我如何解决这个问题。

更新

提供评论中请求的命令输出:

e:\Study\haskell\SOE\src\soe>ghc-pkg list
C:/Program Files/Haskell Platform/2013.2.0.0\lib\package.conf.d:
    Cabal-1.16.0
    GLURaw-1.3.0.0
    GLUT-2.4.0.0
    HTTP-4000.2.8
    HUnit-1.2.5.2
    OpenGL-2.8.0.0
    OpenGLRaw-1.3.0.0
    QuickCheck-2.6
    Win32-2.3.0.0
    array-0.4.0.1
    async-2.0.1.4
    attoparsec-0.10.4.0
    base-4.6.0.1
    bin-package-db-0.0.0.0
    binary-0.5.1.1
    bytestring-0.10.0.2
    case-insensitive-1.0.0.1
    cgi-3001.1.7.5
    containers-0.5.0.0
    deepseq-1.3.0.1
    directory-1.2.0.1
    fgl-5.4.2.4
    filepath-1.3.0.1
    (ghc-7.6.3)
    ghc-prim-0.3.0.0
    hashable-1.1.2.5
    haskell-platform-2013.2.0.0
    haskell-src-1.0.1.5
    (haskell2010-1.1.1.0)
    (haskell98-2.0.0.2)
    hoopl-3.9.0.0
    hpc-0.6.0.0
    html-1.0.1.2
    integer-gmp-0.5.0.0
    mtl-2.1.2
    network-2.4.1.2
    old-locale-1.0.0.5
    old-time-1.1.0.1
    parallel-3.2.0.3
    parsec-3.1.3
    pretty-1.1.1.0
    primitive-0.5.0.1
    process-1.1.0.2
    random-1.0.1.1
    regex-base-0.93.2
    regex-compat-0.95.1
    regex-posix-0.95.2
    rts-1.0
    split-0.2.2
    stm-2.4.2
    syb-0.4.0
    template-haskell-2.8.0.0
    text-0.11.3.1
    time-1.4.0.1
    transformers-0.3.0.0
    unordered-containers-0.2.3.0
    vector-0.10.0.1
    xhtml-3000.2.1
    zlib-0.5.4.1

C:\Users\Sergey\AppData\Roaming\ghc\i386-mingw32-7.6.3\package.con
    aeson-0.6.2.1
    base-unicode-symbols-0.2.2.4
    blaze-builder-0.3.3.0
    cmdargs-0.10.5
    convertible-1.0.11.1
    cpphs-1.17.1
    data-default-0.5.3
    data-default-class-0.0.1
    data-default-instances-base-0.0.1
    data-default-instances-containers-0.0.1
    data-default-instances-dlist-0.0.1
    data-default-instances-old-locale-0.0.1
    dlist-0.6
    ghc-mod-3.1.4
    ghc-paths-0.1.0.9
    ghc-syb-utils-0.2.1.2
    haddock-2.13.2.1
    haskell-src-exts-1.14.0
    hlint-1.8.55
    hscolour-1.20.3
    io-choice-0.0.5
    lifted-base-0.2.1.1
    monad-control-0.3.2.2
    monad-loops-0.4.2
    setenv-0.1.1
    tar-0.4.0.1
    transformers-base-0.4.1
    uniplate-1.6.12


e:\Study\haskell\SOE\src\soe>cabal install Win32-2.3.0.0
Resolving dependencies...
All the requested packages are already installed:
Win32-2.3.0.0
Use --reinstall if you want to reinstall anyway.


e:\Study\haskell\expression\HGL-3.2.0.2>cabal install HGL-3.2.0.2
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: HGL-3.2.0.2
trying: HGL-3.2.0.2:+split-base
rejecting: Win32-2.3.0.0/installed-6e9... (conflict: Win32 =>
base==4.6.0.1/installed-f0c..., HGL-3.2.0.2:split-base => base>=3 && <4)
trying: Win32-2.2.2.0
rejecting: base-4.6.0.1/installed-f0c... (conflict: HGL-3.2.0.2:split-base =>
base>=3 && <4)
rejecting: base-4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0,
4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global
constraint requires installed instance)

2 个答案:

答案 0 :(得分:3)

如果查看HGL的文档,它会将依赖关系声明为:

base (<2), Win32 or
base (<2), X11 or
array, base (==3.*), Win32 or
array, base (==3.*), X11

你有base-4.6.0.1。您不满足要安装的程序包的要求。

真正的问题是,为什么要尝试安装最近在2009年更新的软件包?如果您需要简单的图形库,请使用gloss。如果您需要更强大的图形,请使用Haskell平台附带的OpenGL

答案 1 :(得分:1)

由于.cabal文件中存在错误,您尝试安装的版本无法在Windows上构建。

如果你设法做到了

cabal install HGL-3.2.0.2

它可能会起作用,但可能有一些不兼容的原因,为什么它不会选择自动安装该版本。可能与您已经安装的另一个软件包不兼容。