#### Archived

This topic is now archived and is closed to further replies.

# OpenGL Compilation problems with OpenGL in Linux

This topic is 5492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

To compile my app in Linux, I''m using a Makefile, the contents being the following:  SOURCE=main.cpp EXEC=game CC=gcc FLAGS=-Wall INCPATH=-I/usr/X11R6/include -I/usr/local/include LIBPATH=-L/usr/X11R6/lib -L/usr/local/lib LIBS=-lglut -lGLU -lGL ${EXEC}:${SOURCE} ${CC}${FLAGS} -o ${EXEC} {$SOURCE} ${INCPATH}${LIBPATH} \${LIBS} clean: rm -f game  However, I run ''make'', and I get the following compilation error:  /usr/bin/ld: cannot find -lGLU collect2: ld returned 1 exit status make: *** [game] Error 1  Could anyone please help me figure out why I get this error? My understanding is that I need the .so file... I have both libGLU.so.1.2 and libGLU.so.1.3.500, but I''m not sure if there''s something I have to do to "register" these files, or something along those lines. What do I do? Thanks!!

##### Share on other sites
You shouldn''t have two different versions of the library, but as long as they''re in the same folder (/usr/X11R6/lib, I''d guess) it doesn''t hurt anything.

As root, run ldconfig in a terminal, and then make sure a libGLU.so symlink was created that points at the full libGLU.so.version file. That should be all that''s needed.

##### Share on other sites
Hi,

You will need /usr/X11R6/lib/libGLU.a to compile. It is usually located in the XFree86-devel package, or similar.

good luck,
-Spyro

##### Share on other sites
I tried running ldconfig, but it did not correct the error. Unfortunately I do not have the /usr/X11R6/lib/libGLU.a file. I guess I will have to find it or something. Hopefully I can figure this out, as I want to be able to code projects for porting between Windows and Linux.

##### Share on other sites
first make sure you have the symlinks libGLU.so and libGLU.so.1 which both link to the libGLU.so.1.2 (take the latest).

Then run ldconfig -v , the v flag will make ldconfig print all the libraries found, check to see if you can find libGLU.so (or something like that) in the output. If you find it try to compile (it should work).

If you don''t find it, look into the file /etc/ld.so.conf . This file contains all the paths where ldconfig will look for libraries. If /usr/X11R6/lib isn''t in that list, add it. Then rerun ldconfig and see if it finds libGLU.
Now it should work.

##### Share on other sites
Hi again,

What distribution are you using?

You usually need to install the development packages to be able to compile software. The linker uses the .a files to build to executable. After the executable is compiled, you only need the .so (dynamic libraries) to run software.

I would advise that first Mattman tries install the XFree86-devel package. That should install all of the headers and libs to allow him compile software.

-Sypro

##### Share on other sites
Hey, thanks for the replies. George2''s reply worked for my. I used ''ln -s [orig_filename] [link_filename]'', then I ran ''ldconfig'', and that did the trick. (Actually, I don''t think ldconfig was even needed once I used ln -s.) I needed to create ''[filename].so'' link files that pointed to the ''[filename].so.version_number'' files. Thanks again to everyone for the help!

##### Share on other sites
quote:
Original post by Anonymous Poster
The linker uses the .a files to build to executable. After the executable is compiled, you only need the .so (dynamic libraries) to run software.

.a files are archives aka static libraries. If you link with a static library the appropriate library functions are included in your executable and the shared library is not used. GCC will link with shared libraries (if available) by default on systems that are capable of using shared libraries.

##### Share on other sites
Hi,

Yeah I noticed that after my second post. Guess you learn something every day

-Spyro

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
16
5. 5

• 14
• 29
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002290
×