Reputation: 1363
I just reinstalled QtCreator, created new project (Qt Application) an 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'
(Project is empty, I did'n commit any changes)
Qt Creator 2.7.2
Based on Qt 5.1.0 (32 bit)
Ubuntu 13.04
How do I solve this problem?
Upvotes: 126
Views: 114636
Reputation: 1241
In my case: I have installed QT 32 bit lib in Win10 64 bit and it ran into error, I change to all 64 bit and QT creator run smoothly.
Upvotes: 0
Reputation: 11
My system is Ubuntu 16.04 on x86 computer(with NVIDIA GeForce GPU).
Check the library files located in /usr/lib/x86_64-linux-gnu
ls -al /usr/lib/x86_64-linux-gnu/libG*
If you see the broken link, reinstall libgl1-mesa-glx
sudo apt install --reinstall libgl1-mesa-glx
And, recheck library.
Upvotes: 1
Reputation: 745
This worked for me:
sudo ln -s /usr/lib/libEGL1.so /usr/lib/libGL.so
Upvotes: 1
Reputation: 161
The gui Qt module is included by default. If you don't want to use it in a project (e.g., it is a library or only uses stdio), you need to specify that in the .pro file.
QT -= gui
And the linker won't attempt to find lGL regardless of whether it is installed.
My case is admittedly a bit odd, since the main reason to use Qt is to create gui's. Installing the GL library is certainly not difficult, I just wanted to know why my quick and dirty Hello World wanted it.
Upvotes: 4
Reputation:
write:
yum provides */libGL.so
after providing:
yum install mesa-libGL-devel mesa-libGLU-devel
Upvotes: 2
Reputation: 2082
You should install package "libgl1-mesa-dev":
sudo apt install libgl1-mesa-dev
Upvotes: 188
Reputation: 4411
you don't need to install anything. libGL
is already installed with Ubuntu, you just need to soft link it. (tested for ubuntu 14.x and 15.x, might work for later versions)
Here is how you could do this:
$ 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
Upvotes: 81
Reputation: 1
Solved this problem just a minute ago in suse. Just do the following step below and QTCreator should works just fine.
sudo zypper install --type pattern devel_basis
Upvotes: -1