Very noob doubt about Linux and Opengl

Started by
5 comments, last by let_bound 16 years, 1 month ago
I don't know what's the reason but I can't compile any of the NeHe's opengl tutorials on Linux (I'm using Kubuntu with proprietary nvidia graphic driver installed). Let say, for example, that I try to compile lesson5 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=05) and choose the linux code. mkdir lesson5 cd lesson5 wget http://nehe.gamedev.net/data/lessons/linux/lesson05.tar.gz tar -zxvf lesson05.tar.gz make all gcc -Wall -I/usr/include/ -c -o lesson5.o lesson5.c lesson5.c: In function ‘keyPressed’: lesson5.c:176: warning: implicit declaration of function ‘exit’ lesson5.c:176: warning: incompatible implicit declaration of built-in function ‘exit’ gcc -Wall -I/usr/include/ -o lesson5 -L/usr/X11R6/lib lesson5.o -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm /usr/bin/ld: cannot find -lGL collect2: ld returned 1 exit status make: *** [lesson5] Error 1 rm lesson5.o I don't understand... What I did wrong? Oh, that's what I got inside of my /usr/include/GL/ folder ls /usr/include/GL freeglut_ext.h freeglut_std.h gl.h glu.h glut.h glx.h freeglut.h glext.h gl_mangle.h glu_mangle.h glxext.h glx_mangle.h
Advertisement
It looks like it can't find your libGL.so file.

What are the results of

ls -l /usr/lib/libGL*

Try /usr/lib64 as well if you are using a 64 bit version.

Mine looks like this:
lrwxrwxrwx 1 root root       19 2008-02-20 18:40 /usr/lib/libGLcore.so.1 -> libGLcore.so.169.04-rwxr-xr-x 1 root root 11209884 2008-02-20 18:40 /usr/lib/libGLcore.so.169.04-rw-r--r-- 1 root root      653 2008-02-20 18:40 /usr/lib/libGL.lalrwxrwxrwx 1 root root       10 2008-02-20 18:40 /usr/lib/libGL.so -> libGL.so.1lrwxrwxrwx 1 root root       15 2008-02-20 18:40 /usr/lib/libGL.so.1 -> libGL.so.169.04-rwxr-xr-x 1 root root   664772 2008-02-20 18:40 /usr/lib/libGL.so.169.04lrwxrwxrwx 1 root root       20 2008-02-20 18:19 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.070002-rwxr-xr-x 1 root root   454428 2008-01-22 18:44 /usr/lib/libGLU.so.1.3.070002

Note how, in the case above, libGL.so is a symbolic link that points to libGL.so.1 which points to libGL.so.169.04. Does yours do something similar?
Quote:Original post by dave j
It looks like it can't find your libGL.so file.

What are the results of

ls -l /usr/lib/libGL*

Try /usr/lib64 as well if you are using a 64 bit version.

Mine looks like this:
lrwxrwxrwx 1 root root       19 2008-02-20 18:40 /usr/lib/libGLcore.so.1 -> libGLcore.so.169.04-rwxr-xr-x 1 root root 11209884 2008-02-20 18:40 /usr/lib/libGLcore.so.169.04-rw-r--r-- 1 root root      653 2008-02-20 18:40 /usr/lib/libGL.lalrwxrwxrwx 1 root root       10 2008-02-20 18:40 /usr/lib/libGL.so -> libGL.so.1lrwxrwxrwx 1 root root       15 2008-02-20 18:40 /usr/lib/libGL.so.1 -> libGL.so.169.04-rwxr-xr-x 1 root root   664772 2008-02-20 18:40 /usr/lib/libGL.so.169.04lrwxrwxrwx 1 root root       20 2008-02-20 18:19 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.070002-rwxr-xr-x 1 root root   454428 2008-01-22 18:44 /usr/lib/libGLU.so.1.3.070002

Note how, in the case above, libGL.so is a symbolic link that points to libGL.so.1 which points to libGL.so.169.04. Does yours do something similar?



Mines look like this:
ls -l /usr/lib/libGL*lrwxrwxrwx 1 root root       22 2007-11-20 14:14 /usr/lib/libGLcore.so.1 -> libGLcore.so.100.14.19-rw-r--r-- 1 root root 10040196 2007-11-01 22:22 /usr/lib/libGLcore.so.100.14.19lrwxrwxrwx 1 root root       18 2007-11-20 14:14 /usr/lib/libGL.so.1 -> libGL.so.100.14.19-rw-r--r-- 1 root root   605788 2007-11-01 22:22 /usr/lib/libGL.so.100.14.19-rw-r--r-- 1 root root   688196 2007-10-12 21:38 /usr/lib/libGLU.alrwxrwxrwx 1 root root       11 2007-10-22 16:08 /usr/lib/libGLU.so -> libGLU.so.1lrwxrwxrwx 1 root root       20 2007-10-22 14:40 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.070001-rw-r--r-- 1 root root   533352 2007-10-12 21:38 /usr/lib/libGLU.so.1.3.070001


I'm using 32-bits kubuntu version.
Try creating a symlink named libGL.so pointing to libGL.so.1
My guess would be that the linker is missing the libGL.la and that you need to install the libGL-dev package.
blah :)
As madRenEGadE said, you need to create a symbolic link. Alternatively, you could install the latest Nvidia drivers which should fix the problem for you and any related problems that may be lurking about.
How did you install the NVidia stuff? The "Ubuntu way"(1)? Or the "Windows way"(2)?

In the first case, you probably have to install a package like nvidia-glx-dev (or something like that: try apt-cache search nvidia\*-dev, don't forget the backslash), in order to get the libtoolized libraries, as suggested by kolrabi. It should depend on the other OpenGL development packages, so just typing sudo apt-get install nvidia-glx-dev in a terminal should do it.

In the latter case, you might have to create the symlink manually, as suggested by the other posters (sudo ln -is /usr/lib/libGL.so.1 /usr/lib/libGL.so), and to run ldconfig (sudo ldconfig).

I don't have a Debian box at work to check that, so you'll want to make sure I'm not plain wrong before running anything as root like that.


  1. synaptic, aptitude, apt-get, or dpkg with an official DEB archive

  2. binary installer not integrated with the package manager, probably found on nvidia.com



EDIT: removed quote, deleted multiple posts.

This topic is closed to new replies.

Advertisement