1

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

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

我被困在这里。那么如何安装图表。只要它被安装,我真的不在乎它是如何安装的(有点厌倦了阴谋集团)。

这个包做的很棒的东西

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

4

1 回答 1

2

第二个错误块说:

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

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

cabal install diagrams-1.2

理想情况下,最好找出你的阴谋集团为什么要拉旧版本。cabal install diagrams --dry-run(仅显示将在没有实际安装的情况下提取的软件包)和ghc-pkg list(显示当前系统中的软件包)可能有助于弄清楚这一点。

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

于 2014-06-10T18:13:24.110 回答