3D OpenGL XIG libs error compilation

Hello,

I would like to ask if anybody can have an oppinion what the heck is this about.

I am using Xserver drivers from Xig.com
Summit 2.1 3D. I have an ATI Radeon 8500 64 DDR AGP .

Everything is fine. I’m using also glut from their site and my configurations look like:

ld.so.conf

/lib
/usr/lib
/usr/local/lib
/usr/kerberos/lib
/usr/X11R6/lib
/usr/lib/qt-2.3.1/lib
/usr/lib/qt-1.45/lib
/usr/lib/wine
/usr/lib/mysql
/usr/lib/sane

Under /usr/lib I have:

$ ls -lrt /usr/lib/libGL*
/usr/lib/libGLU.so.1.3
/usr/lib/libGLU.so.1 -> libGLU.so.1.3
/usr/lib/libGLU.so -> /usr/lib/libGLU.so.1.3
/usr/lib/libGL.so.1.2
/usr/lib/libGL.so.1 -> libGL.so.1.2
/usr/lib/libGL.so -> /usr/lib/libGL.so.1.2

$ ls -lrt /usr/lib/libglut*
/usr/lib/libglut.so.3.7
/usr/lib/libglut.a
/usr/lib/libglut.so.3 -> libglut.so.3.7

Everything now if fine. Im learning OpenGL and X Window programming. I’ve downloaded
glsamples.tar.gz from http://www.xmission.com/~nate/tutors-contrib.html

I am under my test directory and try to compile a sample from this.

Example:

This run fine.

gcc nii.c -L/usr/X11R6/lib -lXmu -lglut -lGL -lGLU -lm -o nii

But as normal the compilation should work also like but it does not.

gcc -L/usr/X11R6/lib -lXmu -lglut -lGL -lGLU -lm -o nii nii.c

ending with lots of undefined symbols from glut lib …

/tmp/cc6Hom1R.o: In function display': /tmp/cc6Hom1R.o(.text+0x3cf): undefined reference to glutSwapBuffers’
/tmp/cc6Hom1R.o(.text+0x3ec): undefined reference to glutGet' /tmp/cc6Hom1R.o(.text+0x3fb): undefined reference to glutGet’

Some idea guys what the heck this is about ?

Thank you,
stefan

I think I missed to say: I am running RedHat 7.2 and I think the problem could be that I actually have no static libraries on /usr/lib …

stefan

Originally posted by stefanparvu:
[b]Hello,

Example:

This run fine.

gcc nii.c -L/usr/X11R6/lib -lXmu -lglut -lGL -lGLU -lm -o nii

But as normal the compilation should work also like but it does not.

gcc -L/usr/X11R6/lib -lXmu -lglut -lGL -lGLU -lm -o nii nii.c
[/b]

That’s because nii.c depends on stuff from -lglut, and things that depend on other things need to come first in the command-line.

Thank you very much for answer.

The thing is I have no libglut.a libGL.a and libGLU.a from Summit 3D .

Usually under Unix a static compilation/linking would go like:

gcc -L/path -lglut -lXmu -lGL -lGLU sample.c -o sample

The thing is I am missing the static libraries from /usr/lib . I have only .so and this is improper for ld linker.

I don’t understand anyway how it comes that changing the place of my source code will change the effect in static libraries. Are the .so taken and used as static ones !?

Strange.

Another thing is: What direct rendering is ?
Are the static libraries excluded since “you have tu use direct rendering” and is an obsolete model of development ?

stefan

The linking order is discussed at the bottom of this page http://users.actcom.co.il/~choo/lupg/tutorials/libraries/unix-c-libraries.html
I think you can use some option called -rdynamic, if I remember right, instead of resorting the command line.

Direct rendering lets OpenGL talk directly with the hardware. If you are using indirect rendering is calls made through X. Here is information about how OpenGL integrates with X http://toolbox.sgi.com/linux/documents/OpenGL/overviews.html#mjkOiX

Thank you very much for answer zico
I misunderstood. So the linker will look first for a shared library than a static ones.
I forgot about this. So shortly XIG provides shared libs and it seems fine.
I actually don’t need the static ones. Did I understood right ?

The order of libs is important since the symbols can be dependent on other libs

I will read the http://toolbox.sgi.com/linux/documents/OpenGL/overviews.html#mjkOiX
very intersting.

As well intersting for me is this: “As a rule is to always remember to mention the libraries after
all object files” -

thanks
stefan

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.