[HOpenGL] -O strangeness

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Thu, 07 Mar 2002 20:06:04 +0100


Wolfgang Thaller wrote:
 > [...] Not exactly a solution, but it should explain the problem...

Yep, it looks like a missing header problem. A better solution would be
telling your ghc about a HOpenGL package. Assuming you have successfully
compiled HOpenGL at /my/home/dir/HOpenGL-1.01, create a package configuration
file HOpenGL.conf containing:

--SNIP----SNIP----SNIP----SNIP----SNIP----SNIP----SNIP----SNIP----SNIP--
[Package
     {name = "HOpenGL",
      import_dirs = ["/my/home/dir/HOpenGL-1.01/lib"],
      source_dirs = [],
      library_dirs = ["/my/home/dir/HOpenGL-1.01/lib"],
      hs_libraries = ["HOpenGL"],
      extra_libraries = [],
      include_dirs = [],
      c_includes = ["GL/glut.h"],
      package_deps = ["base"],
      extra_ghc_opts = [],
      extra_cc_opts = ["", "-I/usr/X11R6/include"],
      extra_ld_opts =
        ["",
	"-lglut",
	"-lGLU",
	"-lGL",
	"-lSM",
	"-lICE",
	"-L/usr/X11R6/lib",
	"-lX11",
	"-lXext",
	"-lXmu",
	"-lXt",
	"-lXi",
	"-lm"]}]
--SNIP----SNIP----SNIP----SNIP----SNIP----SNIP----SNIP----SNIP----SNIP--

Your mileage may vary with the extra_ld_opts, have a look at GL_LIBS in your
/my/home/dir/HOpenGL-1.01/config.mk to see what configure found about those.
Then you have the option of making HOpenGL globally know to ghc via

    ghc-pkg --add-package < HOpenGL.conf

and use "-package HOpenGL" or add

    -package-conf HOpenGL.conf -package HOpenGL

to the ghc flags for your example to make it known locally only, see

    http://haskell.org/ghc/docs/latest/set/packages.html#PACKAGE-MANAGEMENT

Things like this are currently all a bit messy, I know, but libraries, package
handling, GLU versions etc. are a constantly moving target. After HOpenGL's
rewrite this will definitely improve...

Have fun rendering,
    S.