Tag Archives: QT compilation error

How to Solev QT compilation error “cannot find – LGL”

Cause: QT cannot find the dynamic link library of OpenGL. QT usually looks for dynamic link libraries in/usr/lib directory, but some Linux distributions will place OpenGL dynamic link libraries in other directories. For example, Ubuntu will be placed in/usr/lib/i386 Linux GNU/Mesa/. There are two solutions:

Method 1: directly copy the OpenGL dynamic link library file in/usr/lib/i386 Linux GNU/Mesa/directory to/usr/lib.

Note: the built-in OpenGL library in Linux will have the version number at the end, such as LIBGL.So.1, LIBGL.So.1.2. However, the file required by QT when linking does not have a version number, that is, libgl.so. Method 2: create a soft link for the OpenGL dynamic link library file in/usr/lib/i386 Linux GNU/Mesa/directory

ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so