如何安装图表?

时间:2014-06-09 22:34:16

标签: haskell installation cabal haskell-diagrams

我正在尝试安装图表包。如果我做

cabal install diagrams

我得到(到最后)

Configuring lens-4.2...
Building lens-4.2...
Preprocessing library lens-4.2...

src/Control/Lens/Internal/Zoom.hs:47:8:
    Could not find module `Control.Monad.Trans.Except'
    It is a member of the hidden package `transformers-0.4.1.0'.
    Perhaps you need to add `transformers' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.
Failed to install lens-4.2
cabal: Error: some packages failed to install:
diagrams-1.2 depends on lens-4.2 which failed to install.
diagrams-contrib-1.1.2 depends on lens-4.2 which failed to install.
diagrams-core-1.2.0.1 depends on lens-4.2 which failed to install.
diagrams-lib-1.2.0.1 depends on lens-4.2 which failed to install.
diagrams-svg-1.1 depends on lens-4.2 which failed to install.
force-layout-0.3.0.4 depends on lens-4.2 which failed to install.
lens-4.2 failed during the building phase. The exception was:
ExitFailure 1

然后我尝试

$cabal install lens transformers diagrams

我得到(到最后)

In-place registering diagrams-lib-1.2.0.1...
Installing library in /home/theking/.cabal/lib/diagrams-lib-1.2.0.1/ghc-7.6.3
Registering diagrams-lib-1.2.0.1...
Installed diagrams-lib-1.2.0.1
cabal: Error: some packages failed to install:
cairo-0.12.5.3 failed during the configure step. The exception was:
ExitFailure 1
diagrams-0.3 depends on glib-0.12.5.4 which failed to install.
diagrams-cairo-1.2 depends on glib-0.12.5.4 which failed to install.
glib-0.12.5.4 failed during the configure step. The exception was:
ExitFailure 1
pango-0.12.5.3 depends on glib-0.12.5.4 which failed to install.

所以我又尝试了一件事

$ cabal install glib
Resolving dependencies...
[1 of 2] Compiling SetupWrapper     ( /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/SetupWrapper.hs, /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/Setup.hs, /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/dist/setup/Main.o )
Linking /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.12.5.4...
setup: The program gtk2hsC2hs version >=0.13.8 is required but the version
found at /usr/bin/gtk2hsC2hs is version 0.13.6
Failed to install glib-0.12.5.4
cabal: Error: some packages failed to install:
glib-0.12.5.4 failed during the configure step. The exception was:
ExitFailure 1

我被困在这里。那么我该如何安装图表呢?只要它安装完毕,我就不会非常关心它的安装方式(稍微厌倦了cabal)。

The awesome stuff this package does

注意:我在linux上。我也试过cabal install gtk2hs-buildtools

1 个答案:

答案 0 :(得分:2)

第二个错误块表示:

diagrams-0.3 depends on glib-0.12.5.4 which failed to install.

diagrams-0.3diagrams的旧版本,在正常情况下,cabal不应该尝试安装它。最新版本的diagrams甚至不依赖于diagrams-cairo,因此只要您不需要开罗后端,就可以通过询问当前版本的{来解决开罗/ GTK问题{1}},如:

diagrams

理想情况下,最好找出为什么你的cabal拉旧版本。 cabal install diagrams-1.2 (仅显示将在未实际安装的情况下提取的软件包)和cabal install diagrams --dry-run(显示系统中当前的软件包)可能有助于确定这一点。

至于与开罗相关的问题,正如Daniel Wagner所说,PATH问题可能会阻止cabal使用您安装的ghc-pkg list的最新版本。例如,您可能有全局安装的工具,这将覆盖您使用cabal完成的本地工具。 gtk2hs-buildtools允许您验证。另外,请检查this relevant question