[HOpenGL] bug in package.conf (ghci -package OpenGL / ghci -package GLUT)

Sven Panne Sven.Panne at aedion.de
Tue Dec 30 11:09:53 EST 2003


Marc A. Ziegert wrote:
> there still exist systems/programs that need a strict sequence of .so files
> to link. i.e. at least ghci on i386-gnu-linux. [...]
> problem to link GLU, because GL has not been linked before.

*sigh* This kind of problem pops up again and again...

> it happens in the package OpenGL, because it is in the package_deps of GLUT.

Correct.

> GLUT's libraries would have the same problem, but --because of package_deps--
> GL and GLU must have been linked before. unnecessary to link them again.

Things are not that easy: Hugs uses the same repository for the hierarchical
libraries, and it doesn't have a notion of "package" (yet). So the linker
options for every package must be "self contained", otherwise building Hugs
would fail. Apart from that, a repetition should not hurt.

> it is:
> 
>  Package
>     {name = "OpenGL",
>      package_deps = ["base"],
>      extra_ld_opts =
>        ["-lGLU",
> 	"-lGL",
>  Package
>     {name = "GLUT",
>      package_deps = ["base", "OpenGL"],
>      extra_ld_opts =
>        ["-lglut",
> 	"-lGLU",
> 	"-lGL",

While I'm writing this mail, Glynn explains what your problem is (your GLUT
is broken). What is the output of "objdump -p" on the dynamic libraries for
GLUT/GLU/GL on your system and what platform are you using exactly? On my
SuSE 8.2 x86 Linux system, libglut.so.3.7 depends on libGLU.so.1, which in
turn depends on libGL.so.1. With this info, dlopen() with the RTLD_GLOBAL
can handle the dependencies automatically, regardless of the order of
libraries in extra_ld_opts.

For static linking, the order given above is *necessary* for some platforms,
e.g. some Solaris versions, IIRC. If library A depends on library B, A must
come before B on the linker commandline, full stop. Some platforms/linkers
have relaxed this condition, but for maximum portability it must stay this
way. Locally you can change your package.conf, of course, but I would
recommend testing both ghc with static linking and ghci.

I've never imagined that the configuration handling for GLUT/GLU/GL would be
so complicated: There are broken/incomplete/missing headers at various funny
locations, broken libraries, differing calling conventions, etc.  :-[

Cheers,
    S.



More information about the HOpenGL mailing list