I am trying to build OpenCV 2.4.1 with OpenGL support, and it keeps faling. I have OpenGL installed in my Ubuntu 11.04, libs are under /usr/lib/libGL.so as usual. I know my
If OpenGL is installed:
apt-get install libgl1-mesa-dev libglu1-mesa-dev libqt4-opengl-dev
And still CMake cannot find OpenGL, then it means there is no libGl.so in /usr/lib/x86_64-linux-gnu/. If there is libGl.so in /usr/lib/x86_64-linux-gnu/mesa/, then this is a case of a missing softlink. Just reinstalling the packages should re-establish that link.
apt-get install --reinstall libgl1-mesa-dev libglu1-mesa-dev libqt4-opengl-dev
Please note that I had to install libqt4-opengl-dev even though I did not care about Qt support in OpenCV or Qt support anywhere else. I am trying to figure out myself why a hefty 80MB or download and install was necessary to make the regular OpenGL work, but this method certainly works in Ubuntu 13.10.