PDA

View Full Version : mesa on linux



alanchinese
06-21-2000, 04:02 AM
I installed mesa 2.6 in my linux 5.2, the headers files are in
/usr/include/GL/* (including gl.h, glu.h, glut.h, etc)
but when I am making a sample program to test GL, using the command

gcc a.c

the compiler says:
/tmp/cca002661.0:In function 'main'
/tmp/cca002661.0 (.text+0xc); undefined reference to 'glutInit').
/tmp...... (same thing repeated) (whatever glut func.
.
.
.
what is the problem? what can I do?
From Alan.

drakaza
06-21-2000, 04:59 AM
Where abouts are the GL LIB's ?, or whatever the linux equivalent is? I usually get that error when a compiled function cannot be found, sorta like not linking opengl32.lib when making a win32 openGL app.

Sorry if you've already checked for this, but some answers are so simple its easy to just overlook them http://www.opengl.org/discussion_boards/ubb/smile.gif

Marrcke
06-24-2000, 05:57 AM
drakaza is right. You need to include the GL libraries on your compile (accually link) line.

you want to do something like
gcc a.c -L/usr/local/Mesa-2.6/lib -lGL -lGLU -lglut


that should clear it up for you.
http://www.opengl.org/discussion_boards/ubb/smile.gif

-Marrcke

[This message has been edited by Marrcke (edited 06-24-2000).]

06-26-2000, 07:29 PM
I just did the same thing as alan, but with with the above command line and I added:

-O -o hello

but I get the following error
./hello: error in loading shared libraries: libGL.so.1 cannot open shared object file: No such file or directory

I should also comment that this error occurs after compiling, linking, when I try to ./hello

06-26-2000, 08:10 PM
> ./hello: error in loading shared libraries: libGL.so.1 cannot open shared
> object file: No such file or directory

this means that it can't find the library at execution time.
That's controled by /etc/ld.so.conf. You need to add the location of the
libGL.so.1 to that list and run ldconfig. I always delete /etc/ld.so.cache
before I run ldconfig, but I'm pretty sure that's not necessary.

-Marrcke
Marc Meyer

alanchinese
06-26-2000, 10:14 PM
I solved my problem earlier, but using not good way.
I code my program in the demos directory, add the simbol in that directory's makefile.
then "make linux". the makefile there will help you to use the approprieate command to compile. and it works!
but I took at look at the makefils and make-config, there are so many options for compiling, even only in linux. can anyone help me to point out which one is useful and which one is not? what shall I do? copy the exactly makefile to my own directory, or what else?
thankx.
From Alan.

ngill
06-27-2000, 02:29 PM
eh? I usually use

g++ code.c -O -lGL -lGLU -lglut -o code

don't worry about the other options =D

then just do ./code