[HOpenGL] Win32 GHC cannot link GLUT

Sven Panne Sven.Panne at aedion.de
Sun Dec 28 13:17:40 EST 2003


Manuel Garcia Rodriguez wrote:
> [...]
> import Graphics.UI.GLUT
> import Graphics.Rendering.OpenGL

Small note: Importing Graphics.UI.GLUT is enough, it re-exports everything from
Graphics.Rendering.OpenGL.

> [...]
> H:\Documents and Settings\manuel>ghc -package GLUT -o HelloWindow HelloWindow.hs

Another small note: GLUT and OpenGL are "auto" packages, i.e. an explicit
"-package GLUT" is only necessary for this kind of one-shot compilation/linking,
not when using "--make" or ghci:

    ghc --make -o HelloWindow HelloWindow.hs

Or even

    ghc --make HelloWindow.hs

resulting in an executable named "a.out". We are all lazy...   :-)

> [...]
> H:/ghc/ghc-6.2/HSGLUT.o: unknown symbol `_glutMainLoop'
> ghc.exe: panic! (the `impossible' happened, GHC version 6.2):
>         can't load package `GLUT'

Ooops, something went wrong during building and/or packaging the .msi file,
the glut32 library is missing in the linking step. This results in your
problem with ghci and the linking problem with ghc. But this can easily be
fixed by manually editing the package.conf file (probably located at
H:/ghc/ghc-6.2/package.conf at your site): Find the package description
for GLUT (name = "GLUT",) look for the next line containing

    extra_ld_opts = [],

and change it to

    extra_ld_opts = ["-lglut32"]

Hope that helps,
    S.




More information about the HOpenGL mailing list