• Announcements

Archived

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

OpenGL Compilation problems with OpenGL in Linux

Recommended Posts

Mattman    336
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
Null and Void    1088
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
Guest Anonymous Poster
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
Mattman    336
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
George2    187
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
Guest Anonymous Poster
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
Mattman    336
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
kronq    122
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
Guest Anonymous Poster
Hi,

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

-Spyro

• Similar Content

• Hi i am new to this forum  i wanted to ask for help from all of you i want to generate real time terrain using a 32 bit heightmap i am good at c++ and have started learning Opengl as i am very interested in making landscapes in opengl i have looked around the internet for help about this topic but i am not getting the hang of the concepts and what they are doing can some here suggests me some good resources for making terrain engine please for example like tutorials,books etc so that i can understand the whole concept of terrain generation.

• By KarimIO
Hey guys. I'm trying to get my application to work on my Nvidia GTX 970 desktop. It currently works on my Intel HD 3000 laptop, but on the desktop, every bind textures specifically from framebuffers, I get half a second of lag. This is done 4 times as I have three RGBA textures and one depth 32F buffer. I tried to use debugging software for the first time - RenderDoc only shows SwapBuffers() and no OGL calls, while Nvidia Nsight crashes upon execution, so neither are helpful. Without binding it runs regularly. This does not happen with non-framebuffer binds.
GLFramebuffer::GLFramebuffer(FramebufferCreateInfo createInfo) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); textures = new GLuint[createInfo.numColorTargets]; glGenTextures(createInfo.numColorTargets, textures); GLenum *DrawBuffers = new GLenum[createInfo.numColorTargets]; for (uint32_t i = 0; i < createInfo.numColorTargets; i++) { glBindTexture(GL_TEXTURE_2D, textures[i]); GLint internalFormat; GLenum format; TranslateFormats(createInfo.colorFormats[i], format, internalFormat); // returns GL_RGBA and GL_RGBA glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, createInfo.width, createInfo.height, 0, format, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); DrawBuffers[i] = GL_COLOR_ATTACHMENT0 + i; glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0); } if (createInfo.depthFormat != FORMAT_DEPTH_NONE) { GLenum depthFormat; switch (createInfo.depthFormat) { case FORMAT_DEPTH_16: depthFormat = GL_DEPTH_COMPONENT16; break; case FORMAT_DEPTH_24: depthFormat = GL_DEPTH_COMPONENT24; break; case FORMAT_DEPTH_32: depthFormat = GL_DEPTH_COMPONENT32; break; case FORMAT_DEPTH_24_STENCIL_8: depthFormat = GL_DEPTH24_STENCIL8; break; case FORMAT_DEPTH_32_STENCIL_8: depthFormat = GL_DEPTH32F_STENCIL8; break; } glGenTextures(1, &depthrenderbuffer); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, createInfo.width, createInfo.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthrenderbuffer, 0); } if (createInfo.numColorTargets > 0) glDrawBuffers(createInfo.numColorTargets, DrawBuffers); else glDrawBuffer(GL_NONE); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "Framebuffer Incomplete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); width = createInfo.width; height = createInfo.height; } // ... // FBO Creation FramebufferCreateInfo gbufferCI; gbufferCI.colorFormats = gbufferCFs.data(); gbufferCI.depthFormat = FORMAT_DEPTH_32; gbufferCI.numColorTargets = gbufferCFs.size(); gbufferCI.width = engine.settings.resolutionX; gbufferCI.height = engine.settings.resolutionY; gbufferCI.renderPass = nullptr; gbuffer = graphicsWrapper->CreateFramebuffer(gbufferCI); // Bind glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); // Draw here... // Bind to textures glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textures[1]); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textures[2]); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); Here is an extract of my code. I can't think of anything else to include. I've really been butting my head into a wall trying to think of a reason but I can think of none and all my research yields nothing. Thanks in advance!

• Hi everyone, I've shared my 2D Game Engine source code. It's the result of 4 years working on it (and I still continue improving features ) and I want to share with the community. You can see some videos on youtube and some demo gifs on my twitter account.
This Engine has been developed as End-of-Degree Project and it is coded in Javascript, WebGL and GLSL. The engine is written from scratch.
This is not a professional engine but it's for learning purposes, so anyone can review the code an learn basis about graphics, physics or game engine architecture. Source code on this GitHub repository.
I'm available for a good conversation about Game Engine / Graphics Programming
• By C0dR
I would like to introduce the first version of my physically based camera rendering library, written in C++, called PhysiCam.
Physicam is an open source OpenGL C++ library, which provides physically based camera rendering and parameters. It is based on OpenGL and designed to be used as either static library or dynamic library and can be integrated in existing applications.

The following features are implemented:
Physically based sensor and focal length calculation Autoexposure Manual exposure Lense distortion Bloom (influenced by ISO, Shutter Speed, Sensor type etc.) Bokeh (influenced by Aperture, Sensor type and focal length) Tonemapping
You can find the repository at https://github.com/0x2A/physicam

I would be happy about feedback, suggestions or contributions.

• By altay
Hi folks,
Imagine we have 8 different light sources in our scene and want dynamic shadow map for each of them. The question is how do we generate shadow maps? Do we render the scene for each to get the depth data? If so, how about performance? Do we deal with the performance issues just by applying general methods (e.g. frustum culling)?
Thanks,

• 17
• 9
• 16
• 68
• 12