[Haskell-cafe] running HGL on OSX

Vojtěch Knyttl knyttv at gmail.com
Sun Feb 14 05:31:23 EST 2010


I am having difficulties running HGL on Mac OSX, Snow Leopard. Here is what I've done:

–– 1. Installed X11 for OSX 
("About" dialog says: The X Window System, XQuartz 2.3.4 (xorg-server 1.4.2-apple45))

–– 2. Got X11 from Hackage – configured, built and installed – however, there where quite a lot of warnings:
[ 8 of 25] Compiling Graphics.X11.Xlib.Color ( Graphics/X11/Xlib/Color.hs, dist/build/Graphics/X11/Xlib/Color.o )

   Warning: The import of `Foreign.C.Types' is redundant
              except perhaps to import instances from `Foreign.C.Types'
            To import instances alone, use: import Foreign.C.Types()
[ 9 of 25] Compiling Graphics.X11.Xlib.Font ( dist/build/Graphics/X11/Xlib/Font.hs, dist/build/Graphics/X11/Xlib/Font.o )

   Warning: A do-notation statement discarded a result of type CInt.
            Suppress this warning by saying "_ <- xTextExtents
                                                    (fromIntegral nchars)
            or by using the flag -fno-warn-unused-do-bind
and so on.

–– 3. Got HGL package, built and installed with some warnings like:
[ 1 of 27] Compiling Graphics.HGL.Internals.Flag ( Graphics/HGL/Internals/Flag.hs, dist/build/Graphics/HGL/Internals/Flag.o )

   Warning: Module `Prelude' is deprecated:
              You are using the old package `base' version 3.x.
              Future GHC versions will not support base version 3.x. You
              should update your code to use the new base version 4.x.
Now, when I try to run simple program like:

main = runGraphics $
	withWindow_ "Hello World Window" (300, 200) $ \ w -> do
	drawInWindow w $ text (100, 100) "Hello World"
	drawInWindow w $ ellipse (100, 80) (200, 180)
	getKey w

it says:

$ ghci graphics.hs 
GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Ok, modules loaded: Main.
Prelude Main> main
Loading package syb- ... linking ... done.
Loading package X11- ... can't load .so/.DLL for: X11 (dlopen(libX11.dylib, 9): image not found)
Prelude Main> 

Just to precise, I have X11 running (it can be seen in the OSX dock)


More information about the Haskell-Cafe mailing list