Haskell gtk2hs, no suitable image found
I'm trying to use GTK+'s Haskell API gtk2hs in OSX. I have installed ghc and haskell-platform via Homebrew.
Then I ran these three commands:
cabal update
cabal install gtk2hs-buildtools
cabal install gtk
I'm trying to make this little program to run:
module GUI where
import Graphics.UI.Gtk
main = do
initGUI
win <- windowNew
onDestroy win mainQuit
widgetShow win
mainGUI
It compiles just fine. But when I run main, I get:
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)
I saw some other examples of this problem while googling, but none suitable in this case.
What is the architecture of your homebrew packages? It looks like gettext may be 64-bit, but ghc currently only supports 32-bit on OS X. You can check the architectures with 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
If you don't see i386 listed as an available architecture, you'll need to recompile gettext (and probably a lot of other libs) as either 32-bit or universal binaries.
精彩评论