0

I've been trying to install VTK on my Ubuntu 14.04. I had some trouble getting things to configure since it couldn't find OpenGL, but I (thought I) fixed that by using

sudo apt-get install freeglut3-dev

and

sudo apt-get install build-essential

as was suggested in this question. However, now I can't run make because the path to libGL.so isn't correct. I've been searching and finding all sorts of strange solutions but can't seem to understand any of them, and I'd like to have a clue what I'm doing before I go typing strange commands into terminal. Here are some ideas:

When I type "locate libGL.so", I get the following:

/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0

Is the problem here that it's getting it from mesa, and those are dangling symlinks as explained here? In which case, how do I remove them? just rm? I don't know how to verify that I for sure don't need those links and I'd rather not delete anything important. Or is the problem related to the .so.1 at the end instead of just .so? Or both?

Another idea: On this website, someone suggested using

sudo ln -s -f -i /usr/lib/libGL.so.1.2 /usr/lib/x86_64-linux-gnu/libGL.so

which I guess in my case would be

sudo ln -s -f -i /usr/lib/libGL.so /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1

right? But regardless, I can't find this approach anywhere else, and they don't give any reason or explanation, so I'm a bit reluctant to use it since I really don't understand what I'd be doing.

One more note: if I type ccmake . and go to the sections labeled "OPENGL_gl_LIBRARY" and "OPENGL_glu_LIBRARY", the paths (respectively) are /usr/lib/libGL and /usr/lib/x86_64-linux-gnu/libGLU.so.

So perhaps another solution would simply be to replace those with the mesa paths--however, it seems as though I might have to do this over and over again since mesa shouldn't be default, if I'm not mistaken--so I don't know whether that's the best solution.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
user3345626
  • 223
  • 1
  • 3
  • 13
  • FreeGLUT is not OpenGL. It's GLUT. GLUT is a 3rd party library that's orthogonal to OpenGL. The OpenGL development package is `libgl1-mesa-devel`. – datenwolf Aug 05 '15 at 07:57

1 Answers1

0

When I type "locate libGL.so", I get the following:

/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0

That's where they belong. Everything in order.

Is the problem here that it's getting it from mesa

No

and those are dangling symlinks as explained here?

No

In which case, how do I remove them?

Don't!

just rm?

Why would you do that? Those are essential libraries part of your system.

Or is the problem related to the .so.1 at the end instead of just .so? Or both?

No. Those belong there, you should read up on sonames


If you can run OpenGL programs then libGL.so is properly installed. The most likely reason is, that the CMake FindOpenGL module doesn't look in all of the linker cache directories for libGL.so (but I'd be surprised by that). I'd start by properly installing the OpenGL development packages (libgl1-mesa-dev) and try again. And if that doesn't suffice you can create a symlink /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 → /usr/lib/libGL.so (but that should be the last resort).

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Ha looks like I had it completely backwards... I had read several places that I didn't want it automatically directed to mesa. I'll try reinstalling libgl1-mesa-dev, thanks – user3345626 Aug 06 '15 at 15:16
  • So that didn't do anything since it was already properly installed. Changing the path in the build config file seemed to do it though. Hopefully that won't cause any future problems – user3345626 Aug 06 '15 at 16:21
  • @user3345626: It should not pose any problems, as long as `libGL.so` is in the set of paths searched by the dynamic linker (see `man ld.so` and `man ldconfig`). Worst case your executable gets an additional `rpath` entry with the absolute path to where your particular `libGL.so` is located, but this `rpath` is only consulted if the library couldn't be located in the default paths. – datenwolf Aug 06 '15 at 16:24