[HOpenGL] problems running SmoothOpenGL3

Michael [Plouj] Ploujnikov ploujj at gmail.com
Fri Jul 31 11:25:45 EDT 2009

I wanted to give the new SmoothOpenGL3.hs example a try, but I ran
into a strange problem with it.

Prior to trying this example, I unregistered the old OpenGL and GLUT
packages and installed new ones with cabal. Below is a list of all the
Haskell packages on my system:

$ ghc-pkg list
    Cabal-, HUnit-, QuickCheck-, X11-1.4.5,
    array-, base-, base-, bytestring-,
    containers-, directory-, (dph-base-0.3),
    (dph-par-0.3), (dph-prim-interface-0.3), (dph-prim-par-0.3),
    (dph-prim-seq-0.3), (dph-seq-0.3), extensible-exceptions-,
    filepath-, (ghc-6.10.3), ghc-prim-, haddock-2.4.2,
    haskell-src-, haskell98-, hpc-, html-,
    integer-, mtl-, network-2.2.1, old-locale-,
    old-time-, packedstring-, parallel-,
    parsec-, pretty-, process-, random-,
    regex-base-, regex-compat-, regex-posix-,
    rts-1.0, stm-, syb-, template-haskell-,
    time-1.1.3, unix-, xhtml-3000.2.0.1, xmonad-0.8.1
    GLURaw-, GLUT-, ObjectName-, OpenGL-,
    OpenGLRaw-, SDL-0.5.5, StateVar-, Tensor-,
    X11-xft-0.3, hinotify-0.2, utf8-string-0.3.5, xmonad-contrib-0.8.1

I copied SmoothOpenGL3.hs from the GLUT- tarball into
the current directory and here is what happened when I tried running
it with runghc:

$ runghc  SmoothOpenGL3.hs
unknown symbol `glutGet'
SmoothOpenGL3.hs: SmoothOpenGL3.hs: unable to load package `GLUT-'
$ ghc-pkg list|grep GLUT
    GLURaw-, GLUT-, ObjectName-, OpenGL-,

$ nm /home/plouj/.cabal/lib/GLUT-|grep
0000000000007720 D
0000000000045060 T
                 U glutGet
                 U glutGetColor
                 U glutGetMenu
                 U glutGetModifiers
                 U glutGetProcAddress
                 U glutGetWindow

I get a similar problem in ghci:

$ ghci
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> :l SmoothOpenGL3.hs
[1 of 1] Compiling Main             ( SmoothOpenGL3.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Loading package syb ... linking ... done.
Loading package base- ... linking ... done.
Loading package array- ... linking ... done.
Loading package containers- ... linking ... done.
Loading package OpenGLRaw- ... linking ... done.
Loading package GLURaw- ... linking ... done.
Loading package ObjectName- ... linking ... done.
Loading package StateVar- ... linking ... done.
Loading package Tensor- ... linking ... done.
Loading package OpenGL- ... linking ... done.
Loading package GLUT- ... linking ... <interactive>:
unknown symbol `glutGet'
ghc: unable to load package `GLUT-'

Finally, this is what I get if I try to compile with 'ghc --make':

$ ghc --make -lglut SmoothOpenGL3.hs # the linker fails without -lglut
similar to this:
[1 of 1] Compiling Main             ( SmoothOpenGL3.hs, SmoothOpenGL3.o )
Linking SmoothOpenGL3 ...
$ ./SmoothOpenGL3
SmoothOpenGL3: user error (unknown GLUT call glutInitContextVersion,
check for freeglut)
$ ldd ./SmoothOpenGL3
	linux-vdso.so.1 =>  (0x00007fffd25ff000)
	libglut.so.3 => /usr/lib64/libglut.so.3 (0x000000323c000000)
	libGLU.so.1 => /usr/lib64/libGLU.so.1 (0x0000003242000000)
	libGL.so.1 => /usr/lib64/libGL.so.1 (0x0000003241c00000)
	libm.so.6 => /lib64/libm.so.6 (0x0000003239400000)
	libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x000000323bc00000)
	libdl.so.2 => /lib64/libdl.so.2 (0x0000003239800000)
	librt.so.1 => /lib64/librt.so.1 (0x000000323a400000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003239000000)
	libXext.so.6 => /usr/lib64/libXext.so.6 (0x000000323b400000)
	libX11.so.6 => /usr/lib64/libX11.so.6 (0x000000323a800000)
	libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x0000003248a00000)
	libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003243e00000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003241000000)
	libXdamage.so.1 => /usr/lib64/libXdamage.so.1 (0x000000323ec00000)
	libXfixes.so.3 => /usr/lib64/libXfixes.so.3 (0x000000323cc00000)
	libdrm.so.2 => /usr/lib64/libdrm.so.2 (0x0000003242400000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003239c00000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003238c00000)
	libXau.so.6 => /usr/lib64/libXau.so.6 (0x000000323ac00000)
	libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x000000323b000000)

I'm not sure if this problem is specific to my setup or if it's a bug
in the new GLUT/OpenGL packages. I would appreciate any help either


More information about the HOpenGL mailing list