• ### Announcements

#### Archived

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

# OpenGL Compilation problems with OpenGL in Linux

## 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

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627660
• Total Posts
2978489
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 10
• 12
• 22
• 13
• 33