Suse doesn't Compile for OpenGL!

I would love to see anyone compile the simple openGL program below
without having problems under Suse. I’ve had no problems compiling under
Redhat and Mandrake. Can it be done with suse?

  1. Someone try to compile this under there version of SUSE.
  2. If successful, what had to be changed? Using gcc, what did you
    type to compile it?

//begin------: opengltest.c
#include
#include
#include

main(int argc, char argv[])
{
glutInit(&argc, argv);
return 0; /
ANSI C requires main to return int. */
}
//end opengltest.c

I get:
gcc -lm -lGL opengltest.c
/tmp/ccAdiovA.o(.text+0x18): In function main': : undefined reference to glutInit’
collect2: ld returned 1 exit status

On my system:
…/ldconfig -p | grep glut
libglut.so.3 (libc6,x86-64) => /usr/lib64/libglut.so.3
libglut.so.3 (libc6) => /usr/lib/libglut.so.3

On my System:-------------------------------------------------
> 3Ddiag
3Ddiag version 0.722
Verifying 3D configuration:
Using 3dinfo


================================================================
No 3D capable graphic chipset found!

Checking GL/GLU/glut runtime configuration:
GL/GLU … done (package xorg-x11-Mesa)
glut … done (package freeglut)

How do i compile the above program (opengltest.c)?

Thanks,
Jason

I think there are similar posts here on the linux forums, not forcedly with suze but redhat or other distributions.

I’ve posted a possibly source from error in beginner’s forum

Originally posted by jasonslife:
[b][…]
2) If successful, what had to be changed? Using gcc, what did you
type to compile it?
[…]

I get:
gcc -lm -lGL opengltest.c
/tmp/ccAdiovA.o(.text+0x18): In function main': : undefined reference toglutInit’
collect2: ld returned 1 exit status

On my system:
…/ldconfig -p | grep glut
libglut.so.3 (libc6,x86-64) => /usr/lib64/libglut.so.3
libglut.so.3 (libc6) => /usr/lib/libglut.so.3
[/b]
You have to link with the glut library, too:
gcc -lm -lGL -lglut opengltest.c

But your 3DInfo seems to indicate that you don’t have a graphic card driver installed that gives you 3D acceleration. The installation of a driver can be slightly different for the different linux distributions so better check the suse help for this specific topic.

First off I have 2 linux boxes running Suse 9.2.
First Box: 32 bit Athlon running 32bit Suse
Second Box: 64 bit AMD-64 running 64bit Suse

Looking at Second Box (64 bit):--------------------------
I have installed packages:
freeglut-2.2.0-82.1.x86_64.rpm
freeglut-32bit-9.2-200410201617.x86_64.rpm
xorg-x11-Mesa-6.8.1-15.1.x86_64.rpm
xorg-x11-Mesa-32bit-9.2-200410201617.x86_64.rpm

Now if you search the ENTIRE system there simply is no “glut.h” anywhere in SUSE.

My solution (which I don’t know if its correct):
Download:
MesaDemos-6.2.1.tar.gz --> contains “glut.h”
MesaLib-6.2.1.tar.gz --> contaings the GL library

(In MesaLib-6.2.1.tar.gz we have): …/Mesa-6.2.1/include/GL/
amesa.h glext.h glu_mangle.h internal svgamesa.h wmesa.h
dmesa.h gl.h glxext.h mesa_wgl.h uglglutshapes.h xmesa.h
fxmesa.h gl_mangle.h glx.h mglmesa.h uglmesa.h xmesa_xf86.h
ggimesa.h glu.h glx_mangle.h osmesa.h vms_x_fix.h xmesa_x.h

Copy the GL directory in the MesaLib-6.2.1.tar.gz into /usr/local/include/
NOTE: there was no ‘GL’ directory in /usr/lib/include/ prior to me copying
it into there.

There’s no “libglut.so” in /usr/lib/ but there is two libglut’s:
/usr/lib/libglut.so.3.8.0
/usr/lib64/libglut.so.3.8.0

So, I create a link:
ln -s /usr/lib64/libglut.so.3.8.0 /usr/lib/libglut.so

Now I want to run…“opengltest.c”
NOTE: I will replace the GREATER than and LESS than with ‘(’ and ‘)’
so that I don’t have problem pasting this to the forumn.

All i’m trying to run is this:
//begin------: opengltest.c
#include (math.h)
#include (stdlib.h)
#include (GL/glut.h)

main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_INDEX | GLUT_DOUBLE);

glutCreateWindow(“Bounce”);
//omit the rest since we can’t get past above
return 0; /* ANSI C requires main to return int. */
}
//end opengltest.c

To compile: gcc -lglut -lGL -lm bounce.c
We get actually compiling:
MyMachine> gcc -lglut -lGL -lm bounce.c
MyMachine> //We compile it fine, and no errors now.

NOTE: before creating the link /usr/lib/libglut.so I got:
(error ‘cannot find -lglut’.)
and to remedy that I had to do all the above to get the point
where I can now compile.

Now trying to run it:
./a.out
Gives error: freeglut_window.c:300: fgOpenWindow: Assertion `window->Window.VisualInfo != ((void *)0)’ failed.

Doing the same thing on my first box (32-bit linux box) I link with:
ln -s /usr/lib/libglut.so.3.8.0 /usr/lib/libglut.so
instead of
ln -s /usr/lib64/libglut.so.3.8.0 /usr/lib/libglut.so
for the 64 bit box.

The result is I get the same error when trying to compile:
“freeglut_window.c:300: fgOpenWindow: Assertion `window->Window.VisualInfo != ((void *)0)’ failed.”

So this fails to run. Am I supposed to get glut.h somewhere else? And maybe i don’t need to create GL directory and put those files in there.

NOTE: ./glxgears runs fine as a OpenGL program and so I know that I can run OpenGL programs.

Any ideas?

The issue is with GLUT_INDEX display mode. I tested it and came up with same errors as you - changing GLUT_INDEX to GLUT_RGB worked. I know that color indexes are no longer supported on newer video cards. I figured they would be supported through software (driver) but perhaps not. Or you might want to contact the developers of freeglut - perhaps it is a bug.

You probably also need to install freeglut-devel-2.2.0-82.1.x86_64.rpm (or something) similar to get the header files and manual pages. This is pretty common. package-version.rpm contains the files needed for applications to use the library, but package-devel-version.rpm contains the files needed for to compile with the library.

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