Qt: can't find -lGL error

自作多情 提交于 2019-11-26 15:14:15
Sayyed Hassan Amiri

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

sudo apt install libgl1-mesa-dev

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)

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

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
Shojib Mahmud

write:

yum provides */libGL.so 

after providing:

yum install mesa-libGL-devel mesa-libGLU-devel

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.

Lastea

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

Check the library file locate 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 --resintall libgl1-mesa-glx

And, recheck library.

This worked for me:

sudo ln -s /usr/lib/libEGL1.so /usr/lib/libGL.so

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!