Please nominate your Qt Champions for 2021!

cannot find -lGL at compil time

  • Hi,
    It's my first installation of Qt

    OS: centos 7 64 bits
    GCC: 4.8.5
    I also installed CLANG: 3.4.2
    I installed QT 5.9.1 and 5.12.2 (same problem with the two)
    OpenGL: 3.0

    The problem: At compil time (it's a test project with just an empty window), i have this error:

    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    make: *** [testmk_6] Error 1
    14:08:31: process "/usr/bin/make" stopped with code 2.
    Error during compilation/déploy of project testmk_6 (kit : Desktop Qt 5.12.2 GCC 64bit2)
    When executing step "Make"

    After research, it seems that lGL library concerns OpenGL, but OpenGL is well installed on my Centos.
    My error is not referenced on internet, so i'm stuck.
    Thanks for information.

  • Moderators

    You need to install development packages for OpenGL (and other Qt dependencies, too). I think for CentOS these would be:

    sudo yum install mesa-libGLU-devel

    Not sure though, I'm not a regular CentOS user (thankfully ;-) It's dinosaur-age state gets on my nerves quickly).

  • Yes Sierdzio you're right.
    It's 'mesa-libGLU-devel'

    So in my case (centos): sudo yum install mesa-libGLU-devel

    And now my Qt compile works fine.


  • Lifetime Qt Champion

    @maxime62 glad you got it working. So please mark this topic as SOLVED now. Thanks

Log in to reply