Qt: cannot find error -lGL

I just reinstalled QtCreator, created a new project (Qt application) and got this after compilation:

/usr/bin/ld: **cannot find -lGL** collect2: error: ld returned 1 exit status make: *** [untitled1] Error 1 18:07:41: The process "/usr/bin/make" exited with code 2. Error while building/deploying project untitled1 (kit: Desktop Qt 5.1.0 GCC 32bit) When executing step 'Make' 

(The project is empty, I did not make any changes)

Qt Creator 2.7.2
Based on Qt 5.1.0 (32 bit)
Ubuntu 13.04

How to solve this problem?

+94
c ++ compiler-construction qt qt-creator
Aug 23 '13 at 15:18
source share
7 answers

You should install the package "libgl1-mesa-dev":

 sudo apt install libgl1-mesa-dev 
+140
Aug 29 '13 at 6:15
source share

You do not need to install anything. libGL already installed with Ubuntu, you just need a soft link. (tested for Ubuntu 14.x and 15.x, may work on later versions)

  1. First find the GL library
  2. Then bind it to / usr / lib
  3. If the library is missing, it can be installed via the libgl1-mesa-dev package

Here's how you could do it:

 $ locate libGL /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.10 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.10.0 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.10 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.10.0 /usr/lib/x86_64-linux-gnu/libGLU.so.1 /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1 /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2 /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2.0.0 $ sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so 
+62
Aug 24 '15 at 13:56
source share

write down:

 yum provides */libGL.so 

after providing:

 yum install mesa-libGL-devel mesa-libGLU-devel 
+2
Nov 29 '18 at 14:42
source share

The gui Qt module is enabled by default . If you do not want to use it in a project (for example, it is a library or uses only stdio), you need to specify this in the .pro file.

 QT -= gui 

And the linker will not try to find lGL regardless of whether it is installed.

My case, admittedly, is a bit strange, since the main reason for using Qt is the creation of graphical interfaces. Installing the GL library is, of course, not difficult, I just wanted to find out why my quick and dirty Hello World wanted this.

+1
Dec 31 '19 at 4:55
source share

My system is Ubuntu 16.04 on an X86 computer (with an NVIDIA Geforce GPU).

Verify that the library file is located in /usr/lib/x86_64-linux-gnu

 ls -al /usr/lib/x86_64-linux-gnu/libG* 

If you see a broken link, reinstall libgl1-mesa-glx

 sudo apt install --resintall libgl1-mesa-glx 

And double-check the library.

+1
Jan 28 '19 at 7:22
source share

This worked for me:

 sudo ln -s /usr/lib/libEGL1.so /usr/lib/libGL.so 
0
Jan 12 '19 at 15:29
source share

Solved this problem just a minute ago in suse. Just take the next step below and QTCreator should work fine.

sudo zypper install --type pattern devel_basis

-one
Dec 03 '17 at 20:09 on
source share



All Articles