Installing Qt on Linux, Cannot Find -Lgl

Installing Qt on linux, cannot find -lGL

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.

qt5: cannot find -lGL

Since I have seen this:

Cannot start '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory

then the solution can be found here: cmake not working, could not exec qmake.

Qt: can't find -lGL error

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

sudo apt install libgl1-mesa-dev

Qt Creator compile error cannot find -lGL. Other solutions are not working

So what I found worked for me, I manual added the path to the library and compiled. Then I was able to remove the manually added path. I assume somewhere on the backend it was not searching the correct place and once it was shown it remembered and kept the correct location.

Qt debian/ubuntu: Can't compile, error: cannot find -lGL

Since this is a linker error, you may have one of two problems:

  • You don't have libGL installed
  • libGL is installed but not in your system path.

If libGL isn't installed, you can install it:

sudo apt-get install libgl1-mesa-dev

I think is the right package. I don't have a debian machine handy so I can't test it.

If you have this package installed, you need to add it to your system path. You'll need to append it to environment variable LD_LIBRARY_PATH or make a .conf file located in /etc/ld.so.conf.d/.

Again, I don't have a debian machine to verify these paths, but that's the best I can do from memory. Either way, this should be enough information to get started.

Good luck!

/usr/bin/ld: cannot find -lGL when building a Qt application

Try:

apt-get install libgl1-mesa-glx

The dev packages are actually not the problem. You have a linker error, not a compiler error.

Depending on your graphic card you might use specialized OpenGL implementation, e.g. something like libgl1-nvidia-glx fror NVIDA cards.



Related Topics



Leave a reply



Submit