Important: Please read the Qt Code of Conduct -

How to solve Issue- "cannot find -lGL" in Qt5 installed in ubuntu

  • I run my project from one system. It run verry well. It is simple addition with GUI. (GUI consist of 3 LineEdit and one pushButton).
    After compling from one system. then i try to run project on another system then it gives following error (issues)

    :-1: error: cannot find -lGL
    :-1: error: collect2: ld returned 1 exit status

    How to solve this problem?? Help me..........
    thank you.........

  • Install the OpenGL development libraries for your system. Probably something along the lines of mesa-devel or gl-devel.

  • For future reference, installing libglu1-mesa-dev worked for me (Ubuntu 12.04)

  • I have the same problem but is already on my system but instead of "/usr/lib" it is in "/usr/lib/i386-linux-gnu/mesa/". I think I just need to tell qtcreator the actual path. Can you tell me hoe to do that?

  • That sounds like the 32-bit support libs rather than the native 64-bit one. Are you running a 64-bit OS? If so you need to find the relevant package that includes

  • My OS is Linux Mint 15 32 bit and it is running as a guest using virtual box on windows 7 64 bit

  • OK then, in that case you need to ensure that the runtime linker, ldd, can find libraries in that directory.

  • yes exactly but how can I do that using qmake can u tell me?

  • It's probably best to fix this at the system level instead. One way would be to symlink within /usr/lib. This may go against your distro's recommended approach for switching between OpenGL implementations, I don't know though.

Log in to reply