Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Qt on linux, cannot find -lGL

I'm having a hard time trying to install Qt on linux. I downloaded the .run file on the website and installed Qt. However, when I try to compile the default Hello World project using Qtcreator, I get the following :

error cannot find -lGL 

I was able to solve the problem by issuing the command :

sudo apt-get install libqt4-dev 

But, I'm not satisfied with the solution as I want to use Qt5 and the name of the lib I downloaded implies version 4. Can someone explain what is going on and tell me if my solution is correct? If not, what should I do to get a working Qt on Linux.

Additional question

The correct answer, as provided by LtWorf, was to install libgl-dev. For future problems of this sort, can someone tell me how I should have guessed that I had to download this particular library? And why are there some libs with -dev at the end? What do they provide?

like image 829
Gradient Avatar asked Mar 12 '13 07:03

Gradient


People also ask

Where is Qt installed Linux?

3) Run the Qt installer run and is likely located in your ~/Downloads directory. Use chmod +x qt*. run to make the file executable, then run it by typing ./qt*.

How install Qt Linux?

Visit Qt downloads page an download a 32-bit or 64-bit Linux installation depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget. This is valid until 5.14. 2 due to policy change, distributing Open Source Qt linux package is discontinue from 5.15.

How do I know if Qt is installed Linux?

That being said, under a Linux system we can simply use the following script to determine whether Qt is installed: if ! test -x /usr/bin/qmake then # The Qt library is missing... echo "error: This script requires Qt to be installed." exit 1 fi # The Qt library is installed ...do your thing...

Is Qt available for Linux?

Qt (pronounced "cute") is cross-platform software for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems with little or no change in the underlying codebase while still being a native ...


2 Answers

Well it is trying to link with libgl and doesn't find it. You should install libgl-dev.

-l is a linker option, it tells the linker to use a certain library. For example you can have -lmagic meaning that you want to use libmagic.

Normally all libraries are called libsomething, and on debian you will find 3 packages called: libsomething libsomething-dbg libsomething-dev

The 1st one is the library, the second one is the library compiled with the debug symbols, so you can make sense of stacktraces more easily, and the final one is the development package, it contains the .h files so you can link to the library.

like image 100
LtWorf Avatar answered Sep 19 '22 12:09

LtWorf


sudo apt-get install libgl-dev

like image 42
Triangle Avatar answered Sep 18 '22 12:09

Triangle