Ошибка cannot find lgl qt

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?

László Papp's user avatar

László Papp

52k39 gold badges111 silver badges135 bronze badges

asked Aug 23, 2013 at 15:18

Hofmn's user avatar

3

You should install package «libgl1-mesa-dev»:

sudo apt install libgl1-mesa-dev

Rando Hinn's user avatar

answered Aug 29, 2013 at 6:15

Sayyed Hassan Amiri's user avatar

3

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

answered Aug 24, 2015 at 13:56

destan's user avatar

destandestan

4,3013 gold badges35 silver badges62 bronze badges

9

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.

answered Dec 31, 2018 at 4:55

squeevee's user avatar

write:

yum provides */libGL.so 

after providing:

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

Suraj Rao's user avatar

Suraj Rao

29.4k11 gold badges94 silver badges103 bronze badges

answered Nov 29, 2018 at 14:42

This worked for me:

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

answered Jan 12, 2019 at 15:29

Sebastian Karlsson's user avatar

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.

truf's user avatar

truf

2,86726 silver badges39 bronze badges

answered Jan 28, 2019 at 7:22

Lastea's user avatar

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.

answered May 16, 2020 at 8:23

nobjta_9x_tq's user avatar

nobjta_9x_tqnobjta_9x_tq

1,20514 silver badges16 bronze badges

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

answered Dec 3, 2017 at 20:09

Anonymous Suomynona's user avatar

0

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?

László Papp's user avatar

László Papp

52k39 gold badges111 silver badges135 bronze badges

asked Aug 23, 2013 at 15:18

Hofmn's user avatar

3

You should install package «libgl1-mesa-dev»:

sudo apt install libgl1-mesa-dev

Rando Hinn's user avatar

answered Aug 29, 2013 at 6:15

Sayyed Hassan Amiri's user avatar

3

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

answered Aug 24, 2015 at 13:56

destan's user avatar

destandestan

4,3013 gold badges35 silver badges62 bronze badges

9

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.

answered Dec 31, 2018 at 4:55

squeevee's user avatar

write:

yum provides */libGL.so 

after providing:

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

Suraj Rao's user avatar

Suraj Rao

29.4k11 gold badges94 silver badges103 bronze badges

answered Nov 29, 2018 at 14:42

This worked for me:

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

answered Jan 12, 2019 at 15:29

Sebastian Karlsson's user avatar

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.

truf's user avatar

truf

2,86726 silver badges39 bronze badges

answered Jan 28, 2019 at 7:22

Lastea's user avatar

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.

answered May 16, 2020 at 8:23

nobjta_9x_tq's user avatar

nobjta_9x_tqnobjta_9x_tq

1,20514 silver badges16 bronze badges

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

answered Dec 3, 2017 at 20:09

Anonymous Suomynona's user avatar

0

Полный текст ошибки
:-1: error: cannot find -lGL
:-1: error: collect2: error: ld returned 1 exit status

Qt creator скачан с центра приложений.
ОС: Ubuntu 13.10


  • Вопрос задан

  • 10429 просмотров

Пригласить эксперта

Скорее всего у вас отсутствует пакет разработчика для библиотеки OpenGL. Установите пакет mesa-common-dev.

sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev

P. S. Такой совет пригодится для любой библиотеки, когда что-то не линкуется.

скорее всего, Qt не может найти библиотеку OpenGL (не знаю, зачем она ему для компиляции свежесозданного девственно чистого проекта в моем случае)
для начала можно посмотреть, на что ссылается симлинк:
ls -l /usr/lib/libGL.so*

  1. удалить существующий /usr/lib/libGL.so
    sudo rm /usr/lib/libGL.so
  2. выполнить в командной строке
    locate libGL.so
  3. принудительно прилинковать любой из найденных файлов в формате
    sudo ln -s -f /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
     /usr/lib/libGL.so

P.S.: совет может оказаться не таким уж и хорошим, но мне в решении аналогичной проблемы помогла именно эта последовательность действий


  • Показать ещё
    Загружается…

22 сент. 2023, в 13:48

300000 руб./за проект

22 сент. 2023, в 13:33

60000 руб./за проект

22 сент. 2023, в 13:26

300000 руб./за проект

Минуточку внимания

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

Read More:

This topic has been deleted. Only users with topic management privileges can see it.

  • i have downloaded qt libraries from http://qt-project.org/downloads > Qt libraries 5.0 RC 2 for Linux 64-bit (382 MB) and installed them.
    when i try to build a Qt Gui Application project with auto-generated files mainwindow.h, mainwindow.cpp and main.cpp i get these messages «cannot find -lGL» and «collect2: ld returned 1 exit status». how to fix it?
    ubuntu 12.04

  • Just install libGL incl. the dev-packages for it.

  • how to do that?

  • Which distribution do you use?

    Wich Graphicsdriver? See my post in 3th party for ati readeon graphiccards.

  • ubuntu 12.04
    nvidia

  • nvidia proprimentar? or «normal»

    open Software-center and search for OpenGL -> install allso -dev packs.

  • how do i find out what kind of driver i have?

  • Did you installed the default driver or have you installed explicit the Nvidia?

  • default

  • what should i install in software center?

  • Solved the problem by installing the “libglu1-mesa-dev” package.
    @sudo apt-get install libglu1-mesa-dev -y@

  • If it matters to you….. On Fedora 18, I used:

    @yum groupinstall «Development Tools»
    yum install mesa-libGL-devel@

  • [quote author=»pitonyak» date=»1360964600″]If it matters to you….. On Fedora 18, I used:

    @yum groupinstall «Development Tools»
    yum install mesa-libGL-devel@
    [/quote]

    Did you ever get this resolved? I installed this on 64bit centos and ran the two commands above to install those rpms but it still does not work

  • [quote author=»pitonyak» date=»1360964600″]If it matters to you….. On Fedora 18, I used:

    @yum groupinstall «Development Tools»
    yum install mesa-libGL-devel@
    [/quote]

    Did you ever get this resolved? I installed this on 64bit centos and ran the two commands above to install those rpms but it still does not work

  • [quote author=»EverydayDiesel» date=»1425071488″]
    [quote author=»pitonyak» date=»1360964600″]If it matters to you….. On Fedora 18, I used:

    @yum groupinstall «Development Tools»
    yum install mesa-libGL-devel@
    [/quote]

    Did you ever get this resolved? I installed this on 64bit centos and ran the two commands above to install those rpms but it still does not work[/quote]Different distros package their software differently. The commands that pitonyak ran were for Fedora 18, not CentOS.

    You need to find out what packages you need to build OpenGL programs in CentOS (e.g. try http://www.qtcentre.org/threads/58151-IGL-error-in-CentOS-6 )

  • [quote author=»EverydayDiesel» date=»1425071488″]
    [quote author=»pitonyak» date=»1360964600″]If it matters to you….. On Fedora 18, I used:

    @yum groupinstall «Development Tools»
    yum install mesa-libGL-devel@
    [/quote]

    Did you ever get this resolved? I installed this on 64bit centos and ran the two commands above to install those rpms but it still does not work[/quote]Different distros package their software differently. The commands that pitonyak ran were for Fedora 18, not CentOS.

    You need to find out what packages you need to build OpenGL programs in CentOS (e.g. try http://www.qtcentre.org/threads/58151-IGL-error-in-CentOS-6 )

  • Thanks for the reply.

    I have ran these commands

    @yum install mesa-libGL-devel mesa-libGLU-devel
    yum install qt
    yum install qt-creator@

    and then installed Qt 5.4.1 for Android (Linux 64-bit, 616 MB)

    I am on centos 7 x64 but it still does not work

  • Thanks for the reply.

    I have ran these commands

    @yum install mesa-libGL-devel mesa-libGLU-devel
    yum install qt
    yum install qt-creator@

    and then installed Qt 5.4.1 for Android (Linux 64-bit, 616 MB)

    I am on centos 7 x64 but it still does not work

Понравилась статья? Поделить с друзьями:
  • Ошибка cannot find 1536x864x32 video mode crmp
  • Ошибка can атего
  • Ошибка c98b пежо 308
  • Ошибка cannot create renderer
  • Ошибка can t resolve