Linux install problem

I am using Redhat 7.1 with gcc 2.96. I installed Mesa, Mesa-devel, glut, and
glut-devel which are built by PLD and downloaded from http://rpmfind.net
zhiw@localhost[1019]:~/currentHw/csc471–>rpm -q Mesa Mesa-devel glut
glut-devel
Mesa-3.4.1-1
Mesa-devel-3.4.1-1
glut-3.7-9
glut-devel-3.7-9

I did find something like:


GLAPI void GLAPIENTRY glClear( GLbitfield mask );


in /usr/X11R6/include/GL/gl.h, but I still get error message like:

zhiw@localhost[1047]:~/currentHw/csc471–>g++ -I/usr/X11R6/include
skeleton.cpp
/tmp/ccjNqwCg.o: In function display(void)': /tmp/ccjNqwCg.o(.text+0xf): undefined reference toglClear’
/tmp/ccjNqwCg.o(.text+0x1c): undefined reference to glBegin' /tmp/ccjNqwCg.o(.text+0x30): undefined reference toglColor3f’

It seems I missed something, may be I do’t have the object file of gl.h. The
only object files from Mesa-devel I found are
/usr/X11R6/lib/libGL.so
/usr/X11R6/lib/libGLU.so


this is a portion of example code I used:
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>

void display() {

glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
  glColor3f(1.0, 0.0, 0.0);

Can anyone guess what what I missed?

yup, not linking to the opengl libs…

try compiling with -lgl -lglu flags …

It just said can’t find it:
zhiw@localhost[1157]:~/currentHw/csc471–>gcc -I/usr/X11R6/include -lgl -lglu skeleton.cpp
/usr/bin/ld: cannot find -lgl
collect2: ld returned 1 exit status

what should I do?

Originally posted by Rob The Bloke:
[b]yup, not linking to the opengl libs…

try compiling with -lgl -lglu flags …[/b]

Its case sensitive, try -lGL -lGLU

I just installed glut by source code and I downloaded a Makefile and tried:

zhiw@localhost[1007]:~/currentHw/csc471–>make
gcc -Wall -I/usr/X11R6/include/ -I/usr/local/glut-3.7/include -o cube -L/usr/X11R6/lib -I/usr/local/glut-3.7/lib cube.o -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm
/usr/lib/gcc-lib/i386-redhat-linux/2.96/…/…/…/libglut.so: undefined reference to glXBindChannelToWindowSGIX' /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libglut.so: undefined reference toglXCreateContextWithConfigSGIX’
/usr/lib/gcc-lib/i386-redhat-linux/2.96/…/…/…/libglut.so: undefined reference to glXGetFBConfigAttribSGIX' /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libglut.so: undefined reference toglXQueryChannelDeltasSGIX’
/usr/lib/gcc-lib/i386-redhat-linux/2.96/…/…/…/libglut.so: undefined reference to glXChannelRectSyncSGIX' /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libglut.so: undefined reference toglXChannelRectSGIX’
/usr/lib/gcc-lib/i386-redhat-linux/2.96/…/…/…/libglut.so: undefined reference to glXQueryChannelRectSGIX' /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libglut.so: undefined reference toglXGetFBConfigFromVisualSGIX’
collect2: ld returned 1 exit status
make: *** [cube] Error 1


any idea?

OK, I just get everything working. I got mess up because I installed Mesa, Mesa-devel, glut, glut-devel by rpm.

so I removed glut, glut-devel, Mesa-devel, and downloaded MesaLib and MesaDemo from www.mesa3d.org and installed it. things work completely fine.

But I may have messed up my /usr/lib and /usr/include by copied some files on it, but whatever, as long as I can do my homework, I fix it later

so with -lglut -lGL -lGLU option, I can compile my homework.

thank you for all the help.

Originally posted by zhiw13:
OK, I just get everything working. I got mess up because I installed Mesa, Mesa-devel, glut, glut-devel by rpm.

The install by rpms works fine, at least if you know what you are doing. Perhaps you should have taken the rpms for Redhat and not the PLD ones. And next time you may want to ask in the Linux forum. But glad that you got it working. Have fun coding OpenGL.

But the problem of rpm is dependence or conflict. I only got Redhat 7.1 and don’t want to upgrade. so I can’t install lots of software. I know I should upgrade. But Redhat 8 and Redhat 9 didn’t work well enough in my IBM Thinkpad T21 laptop. I am only a student and don’t have enough time to upgrade to recent software. I got lots of problems like this. Well, really have not solution.

No offence meant, but I think you missed the ‘if you know what you are doing’ part of my message. I just wanted to state that it is possible to install glut and mesa with rpm and get it working (at least it was when I was on Redhat 7.1). You should have tried to use the rpms included with Redhat 7.1 first and not the ones for a different distro. And conflict/dependency problems are mostly wrong usage and no general rpm problem. There is nothing wrong with installations from source, but for most users it is easier to just install the rpms when there is no real need to use the source.

thank you

Originally posted by satan:
No offence meant, but I think you missed the ‘if you know what you are doing’ part of my message. I just wanted to state that it is possible to install glut and mesa with rpm and get it working (at least it was when I was on Redhat 7.1). You should have tried to use the rpms included with Redhat 7.1 first and not the ones for a different distro. And conflict/dependency problems are mostly wrong usage and no general rpm problem. There is nothing wrong with installations from source, but for most users it is easier to just install the rpms when there is no real need to use the source.