安装gtk2hs

时间:2012-04-02 19:37:23

标签: haskell gtk install gtk2hs

我已经安装了gtk2hs-buildtools没有问题,但是当我尝试使用'cabal install gtk'安装gtk时,这是输出:

[gautam@gautam ~]$ cabal install gtk
Resolving dependencies...
[1 of 2] Compiling SetupWrapper     ( /tmp/cairo-0.12.213784/cairo-0.12.2/SetupWrapper.hs, /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /tmp/cairo-0.12.213784/cairo-0.12.2/Setup.hs, /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/Main.o )
Linking /tmp/cairo-0.12.213784/cairo-0.12.2/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 ...
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).
[1 of 2] Compiling SetupWrapper     ( /tmp/glib-0.12.213784/glib-0.12.2/SetupWrapper.hs, /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /tmp/glib-0.12.213784/glib-0.12.2/Setup.hs, /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/Main.o )
Linking /tmp/glib-0.12.213784/glib-0.12.2/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 ...
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).
cabal: Error: some packages failed to install:
cairo-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gio-0.12.2 depends on glib-0.12.2 which failed to install.
glib-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gtk-0.12.2 depends on glib-0.12.2 which failed to install.
pango-0.12.2 depends on glib-0.12.2 which failed to install.
[gautam@gautam ~]$ 

我的Mac和Fedora VM都会出现此问题。有人知道如何解决这个问题吗?谢谢!

1 个答案:

答案 0 :(得分:10)

您需要将Gtk2Hs构建工具存储的路径添加到$PATH环境变量中,以便构建过程可以找到它们。在Linux上,它是$HOME/.cabal/bin。在OS X上,它是$HOME/Library/Haskell/bin(尽管可能只是在您使用Haskell平台时 - 如果这不起作用,请尝试$HOME/.cabal/bin)。

要向$PATH添加目录,请运行export PATH=directory:$PATH。您应该将其添加到shell的启动文件中(这取决于您的shell和操作系统 - 可能是~/.bashrc~/.profile~/.bash_profile)。 (如果您想直接运行使用cabal安装的任何程序,则需要这样做。)