[HOpenGL] bug in package.conf (ghci -package OpenGL / ghci
-package GLUT)
Marc A. Ziegert
coeus at gmx.de
Tue Dec 30 17:01:35 EST 2003
hm, thanks. learned something about dynamic libs.
what is the ghc option to link statically?
ghc -static --make Main.hs
works perfectly with GLU GL in package.conf. -dynamic does not. (didn't read about it in the manual, just guessing.)
coeus at titan ~/Documents/haskell/hopengl/62/callbacks $ ghc -dynamic --make Main.hs
Chasing modules from: Main.hs
Skipping GlutInterface ( ./GlutInterface.hs, ./GlutInterface.o )
Skipping Display ( ./Display.hs, ./Display.o )
Skipping Main ( Main.hs, Main.o )
Linking ...
gcc: /usr/lib/ghc-6.2/Main.dll_o: Datei oder Verzeichnis nicht gefunden
gcc: /usr/lib/ghc-6.2/PrelMain.dll_o: Datei oder Verzeichnis nicht gefunden
coeus at titan ~/Documents/haskell/hopengl/62/callbacks
i've got a P4-1.3GHz ( Dell :( )
gentoo linux
x11-base/xfree-4.3.0-r2
media-libs/glut-3.7.1
ATI-Radeon 9500pro
ati-drivers from ati homepage: http://www2.ati.com/drivers/linux/fglrx-glc22-4.3.0-3.2.8.i586.rpm (timestamp=2003-11-24)
- Marc
coeus at titan ~ $ l /usr/lib/libGL*
lrwxrwxrwx 1 root root 38 2003-11-25 23:51 /usr/lib/libGL.so -> /usr/lib/opengl/xfree/lib/libGL.so.1.2*
lrwxrwxrwx 1 root root 38 2003-11-25 23:51 /usr/lib/libGL.so.1 -> /usr/lib/opengl/xfree/lib/libGL.so.1.2*
-rw-r--r-- 1 root root 689588 2003-10-22 17:06 /usr/lib/libGLU.a
-rw-r--r-- 1 root root 769 2003-10-22 17:06 /usr/lib/libGLU.la
lrwxrwxrwx 1 root root 13 2003-10-22 17:06 /usr/lib/libGLU.so -> libGLU.so.1.3*
lrwxrwxrwx 1 root root 13 2003-10-22 17:06 /usr/lib/libGLU.so.1 -> libGLU.so.1.3*
-rwxr-xr-x 1 root root 597801 2003-10-22 17:06 /usr/lib/libGLU.so.1.3*
coeus at titan ~ $ l /usr/lib/libglut*
-rw-r--r-- 1 root root 736 2003-10-14 19:27 /usr/lib/libglut.la
lrwxrwxrwx 1 root root 16 2003-10-14 19:27 /usr/lib/libglut.so -> libglut.so.3.7.1*
lrwxrwxrwx 1 root root 16 2003-10-14 19:27 /usr/lib/libglut.so.3 -> libglut.so.3.7.1*
-rwxr-xr-x 1 root root 306255 2003-10-14 19:27 /usr/lib/libglut.so.3.7.1*
coeus at titan ~ $ qpkg -f /usr/lib/libGLU.so
x11-base/xfree *
coeus at titan ~ $ qpkg -f /usr/lib/libglut.so
media-libs/glut *
coeus at titan ~ $ cat /usr/lib/libGLU.la
# libGLU.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libGLU.so.1'
# Names of this library.
library_names='libGLU.so.1.3 libGLU.so.1 libGLU.so'
# The name of the static archive.
old_library=''
# Libraries that this one depends upon.
dependency_libs=' -L/usr/lib -L/usr/X11R6/lib -lGL -lSM -lICE -lXmu -lXt -lXext -lXi -lX11 -ldl -lpthread '
# Version information for libGLU.
current=4
age=3
revision=0
# Is this an already installed library?
installed=yes
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/lib'
coeus at titan ~ $ cat /usr/lib/libglut.la
# libglut.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libglut.so.3'
# Names of this library.
library_names='libglut.so.3.7.1 libglut.so.3 libglut.so'
# The name of the static archive.
old_library=''
# Libraries that this one depends upon.
dependency_libs=' -L/usr/X11R6/lib -lSM -lICE -lXmu -lXext -lXi -lX11'
# Version information for libglut.
current=10
age=7
revision=1
# Is this an already installed library?
installed=yes
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/lib'
coeus at titan ~ $ objdump -p /usr/lib/libGLU.so
/usr/lib/libGLU.so: file format elf32-i386
Program Header:
LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
filesz 0x0007eb9f memsz 0x0007eb9f flags r-x
LOAD off 0x0007eba0 vaddr 0x0007fba0 paddr 0x0007fba0 align 2**12
filesz 0x00001374 memsz 0x00001378 flags rw-
DYNAMIC off 0x0007f288 vaddr 0x00080288 paddr 0x00080288 align 2**2
filesz 0x000000e0 memsz 0x000000e0 flags rw-
EH_FRAME off 0x00077e00 vaddr 0x00077e00 paddr 0x00077e00 align 2**2
filesz 0x00001234 memsz 0x00001234 flags r--
Dynamic Section:
NEEDED libstdc++.so.5
NEEDED libm.so.6
NEEDED libc.so.6
NEEDED libgcc_s.so.1
SONAME libGLU.so.1
INIT 0x13254
FINI 0x71af0
HASH 0xb4
STRTAB 0x7230
SYMTAB 0x2450
STRSZ 0x95dd
SYMENT 0x10
PLTGOT 0x8037c
PLTRELSZ 0x1578
PLTREL 0x11
JMPREL 0x11cdc
REL 0x1127c
RELSZ 0xa60
RELENT 0x8
VERNEED 0x111cc
VERNEEDNUM 0x4
VERSYM 0x1080e
RELCOUNT 0x3a
Version References:
required from libgcc_s.so.1:
0x0b792650 0x00 08 GCC_3.0
required from libstdc++.so.5:
0x081a2972 0x00 05 GLIBCPP_3.2
0x056bafd2 0x00 04 CXXABI_1.2
required from libc.so.6:
0x09691f73 0x00 07 GLIBC_2.1.3
0x0d696911 0x00 06 GLIBC_2.1
0x0d696910 0x00 03 GLIBC_2.0
required from libm.so.6:
0x0d696910 0x00 02 GLIBC_2.0
coeus at titan ~ $ objdump -p /usr/lib/libglut.so
/usr/lib/libglut.so: file format elf32-i386
Program Header:
LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
filesz 0x000286f8 memsz 0x000286f8 flags r-x
LOAD off 0x00028700 vaddr 0x00029700 paddr 0x00029700 align 2**12
filesz 0x0000d1ec memsz 0x0000d410 flags rw-
DYNAMIC off 0x00035388 vaddr 0x00036388 paddr 0x00036388 align 2**2
filesz 0x000000f8 memsz 0x000000f8 flags rw-
Dynamic Section:
NEEDED libSM.so.6
NEEDED libICE.so.6
NEEDED libXmu.so.6
NEEDED libXext.so.6
NEEDED libXi.so.6
NEEDED libX11.so.6
NEEDED libc.so.6
SONAME libglut.so.3
INIT 0xbcc8
FINI 0x1c760
HASH 0x94
STRTAB 0x2600
SYMTAB 0xb60
STRSZ 0x1a01
SYMENT 0x10
PLTGOT 0x36494
PLTRELSZ 0x610
PLTREL 0x11
JMPREL 0xb6b8
REL 0x4388
RELSZ 0x7330
RELENT 0x8
VERNEED 0x4358
VERNEEDNUM 0x1
VERSYM 0x4002
RELCOUNT 0xda2
Version References:
required from libc.so.6:
0x09691f73 0x00 03 GLIBC_2.1.3
0x0d696910 0x00 02 GLIBC_2.0
coeus at titan ~ $
Am Dienstag, 30. Dezember 2003 11:09 schrieb Sven Panne:
> 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