Haskell gtk2hs,找不到合适的图像

时间:2010-11-30 20:04:30

标签: macos haskell gtk

我正在尝试在OSX中使用GTK +的Haskell API gtk2hs。我通过Homebrew安装了ghc和haskell-platform。

然后我运行了这三个命令:

cabal update
cabal install gtk2hs-buildtools
cabal install gtk

我正在努力让这个小程序运行:

module GUI where

import Graphics.UI.Gtk

main = do
  initGUI
  win <- windowNew
  onDestroy win mainQuit
  widgetShow win
  mainGUI

它编译得很好。但是当我运行main时,我得到:

Loading package array-0.3.0.1 ... linking ... done.
Loading package bytestring-0.9.1.7 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package filepath-1.1.0.4 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.5 ... linking ... done.
Loading package unix-2.4.0.2 ... linking ... done.
Loading package directory-1.0.1.1 ... linking ... done.
Loading package process-1.0.1.3 ... linking ... done.
Loading package time-1.1.4 ... linking ... done.
Loading package random-1.0.0.2 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package mtl-2.0.1.0 ... linking ... done.
Loading package cairo-0.12.0 ... linking ... done.
Loading package glib-0.12.0 ... can't load .so/.DLL for: intl (dlopen(/usr/local/Cellar/gettext/0.17/lib/libintl.dylib, 9): no suitable image found.  Did find:
    /usr/local/Cellar/gettext/0.17/lib/libintl.dylib: mach-o, but wrong architecture)

我在google搜索时看到了这个问题的其他一些例子,但在这种情况下没有一个适合。

1 个答案:

答案 0 :(得分:2)

您的自制软件包的架构是什么?看起来gettext可能是64位,但ghc目前只支持OS X上的32位。您可以使用lipo检查架构:

MacBook-1:~ john$ lipo -info /opt/local/lib/libintl.dylib 
Architectures in the fat file: /opt/local/lib/libintl.dylib are: i386 x86_64

如果您没有将i386列为可用架构,则需要将gettext(可能还有很多其他库)重新编译为32位或通用二进制文件。