[Haskell-cafe] Re: [Haskell] GHC 6.10 and OpenGL

Claus Reinke claus.reinke at talk21.com
Tue Dec 2 13:04:41 EST 2008


>>     ghc --make -package OpenGL -package GLUT something.hs
>> I get nothing but undefined references in the linking phase.
>>     C:\Program Files\Haskell\GLUT-2.1.1.2\ghc-6.11.20081202/libHSGLUT-2.1.1.2.a(Window.o):fake:
>> (.text+0x15): undefined reference to `glutWarpPointer'
>
> Does ghc-pkg describe OpenGL tell you that the package needs some gl C
> lib? Eg "ld-options: -lGLU -lGL -lm"

Yes:

    $ ghc-pkg field OpenGL 
import-dirs,library-dirs,hs-libraries,include-dirs,includes,cc-options,ld-options
    import-dirs: "C:\\Program Files\\Haskell\\OpenGL-2.2.1.1\\ghc-6.11.20081202"
    library-dirs: "C:\\Program Files\\Haskell\\OpenGL-2.2.1.1\\ghc-6.11.20081202"
    hs-libraries: HSOpenGL-2.2.1.1
    include-dirs: "C:\\Program Files\\Haskell\\OpenGL-2.2.1.1\\ghc-6.11.20081202\\include"
    includes: HsOpenGL.h
    cc-options:
    ld-options: -lglu32 -lopengl32

    $ ghc-pkg field GLUT 
import-dirs,library-dirs,hs-libraries,include-dirs,includes,cc-options,ld-options
    import-dirs: "C:\\Program Files\\Haskell\\GLUT-2.1.1.2\\ghc-6.11.20081202"
    library-dirs: "C:\\Program Files\\Haskell\\GLUT-2.1.1.2\\ghc-6.11.20081202"
    hs-libraries: HSGLUT-2.1.1.2
    include-dirs: "C:\\Program Files\\Haskell\\GLUT-2.1.1.2\\ghc-6.11.20081202\\include"
    includes: HsGLUT.h
    cc-options:
    ld-options: -lglut32 -lglu32 -lopengl32

> When you ghc --make -v, is it actually linking to a gl C lib?

It looks that way:

*** Linker: (slightly reformated)
C:\ghc\ghc-6.11.20081202\gcc

-BC:\ghc\ghc-6.11.20081202\gcc-lib/

-IC:\ghc\ghc-6.11.20081202\include/mingw/ -v -o Lift.exe
-DDONT_WANT_WIN32_DLL_SUPPORT obj\Main.o obj\FunWorlds.o
obj\Scene.o obj\Behavior.o C:\DOCUME~1\cr3\LOCALS~1\Temp\/ghc3144_0/ghc3144_0.o

-LC:\Program Files\Haskell\GLUT-2.1.1.2\ghc-6.11.20081202

-LC:\Program Files\Haskell\containers-0.2.0.0\ghc-6.11.20081202

-LC:\Program Files\Haskell\OpenGL-2.2.1.1\ghc-6.11.20081202

-LC:\ghc\ghc-6.11.20081202\haskell98-1.0.1.0 -LC:\ghc\ghc-6.11.20081202\random-1.0.0.1
-LC:\ghc\ghc-6.11.20081202\process-1.0.1.1 -LC:\ghc\ghc-6.11.20081202\directory-1.0.0.2
-LC:\ghc\ghc-6.11.20081202\old-time-1.0.0.1 -LC:\ghc\ghc-6.11.20081202\old-locale-1.0.0.1
-LC:\ghc\ghc-6.11.20081202\filepath-1.1.0.1 -LC:\ghc\ghc-6.11.20081202\Win32-2.2.0.0
-LC:\ghc\ghc-6.11.20081202\bytestring-0.9.1.4
-LC:\Program Files\Haskell\array-0.2.0.0\ghc-6.11.20081202 -LC:\ghc\ghc-6.11.20081202\base-3.0.3.0
-LC:\ghc\ghc-6.11.20081202\syb-0.1.0.0 -LC:\ghc\ghc-6.11.20081202\base-4.0.0.0
-LC:\ghc\ghc-6.11.20081202\integer-0.1.0.0 -LC:\ghc\ghc-6.11.20081202\ghc-prim-0.1.0.0
-LC:\ghc\ghc-6.11.20081202 -LC:\ghc\ghc-6.11.20081202/gcc-lib

-lHSGLUT-2.1.1.2 -lglut32 -lglu32 -lopengl32 -lHScontainers-0.2.0.0
-lHSOpenGL-2.2.1.1 -lglu32 -lopengl32

-lHShaskell98-1.0.1.0 -lHSrandom-1.0.0.1 -lHSprocess-1.0.1.1 -lHSdirectory-1.0.0.2
-lHSold-time-1.0.0.1 -lHSold-locale-1.0.0.1 -lHSfilepath-1.1.0.1 -lHSWin32-2.2.0.0
-luser32 -lgdi32 -lwinmm -lkernel32 -ladvapi32 -lHSbytestring-0.9.1.4 -lHSarray-0.2.0.0
-lHSbase-3.0.3.0 -lHSsyb-0.1.0.0 -lHSbase-4.0.0.0 -lwsock32 -lmsvcrt -lkernel32
-luser32 -lshell32 -lHSinteger-0.1.0.0 -lHSghc-prim-0.1.0.0 -lHSrts -lm -lgmp -lwsock32
-u _ghczmprim_GHCziTypes_Izh_static_info -u _ghczmprim_GHCziTypes_Czh_static_info
-u _ghczmprim_GHCziTypes_Fzh_static_info -u _ghczmprim_GHCziTypes_Dzh_static_info
-u _base_GHCziPtr_Ptr_static_info -u _base_GHCziWord_Wzh_static_info
-u _base_GHCziInt_I8zh_static_info -u _base_GHCziInt_I16zh_static_info
-u _base_GHCziInt_I32zh_static_info -u _base_GHCziInt_I64zh_static_info
-u _base_GHCziWord_W8zh_static_info -u _base_GHCziWord_W16zh_static_info
-u _base_GHCziWord_W32zh_static_info -u _base_GHCziWord_W64zh_static_info
-u _base_GHCziStable_StablePtr_static_info -u _ghczmprim_GHCziTypes_Izh_con_info
-u _ghczmprim_GHCziTypes_Czh_con_info -u _ghczmprim_GHCziTypes_Fzh_con_info
-u _ghczmprim_GHCziTypes_Dzh_con_info -u _base_GHCziPtr_Ptr_con_info
-u _base_GHCziPtr_FunPtr_con_info -u _base_GHCziStable_StablePtr_con_info
-u _ghczmprim_GHCziBool_False_closure -u _ghczmprim_GHCziBool_True_closure
-u _base_GHCziPack_unpackCString_closure -u _base_GHCziIOBase_stackOverflow_closure
-u _base_GHCziIOBase_heapOverflow_closure
-u _base_ControlziExceptionziBase_nonTermination_closure
-u _base_GHCziIOBase_blockedOnDeadMVar_closure
-u _base_GHCziIOBase_blockedIndefinitely_closure
-u _base_ControlziExceptionziBase_nestedAtomically_closure
-u _base_GHCziWeak_runFinalizzerBatch_closure -u _base_GHCziTopHandler_runIO_closure
-u _base_GHCziTopHandler_runNonIO_closure
-u _base_GHCziConc_ensureIOManagerIsRunning_closure -u _base_GHCziConc_runSparks_closure
-lHSffi

$ ls C:/ghc/ghc-6.11.20081202/gcc-lib/*gl*
C:/ghc/ghc-6.11.20081202/gcc-lib/CRT_noglob.o  C:/ghc/ghc-6.11.20081202/gcc-lib/libglut.a
C:/ghc/ghc-6.11.20081202/gcc-lib/libglaux.a    C:/ghc/ghc-6.11.20081202/gcc-lib/libglut32.a
C:/ghc/ghc-6.11.20081202/gcc-lib/libglu32.a    C:/ghc/ghc-6.11.20081202/gcc-lib/libopengl32.a

>> Btw, is the format for the cabal config file documented somewhere?
>> I though I had set documentation to True.
>
> At the moment only in the config file itself. It lists all the fields
> (commented out) and where there are default values it lists those too.

ah, I wasn't sure whether those '--' were meant to indicate options or
commenting (a comment in the first line might make usage unambiguous?-)

Claus



More information about the Haskell-Cafe mailing list