Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cannot find -lGL Error
Forum Updated to NodeBB v4.3 + New Features

cannot find -lGL Error

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 5 Posters 3.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eswar
    wrote on last edited by
    #1

    If i run the application in linux laptop. I got the following error, while builds.
    cannot find -lGL
    error: collect2: error: ld returned 1 exit status

    Based on the google search and install the following library package using command line.

    sudo apt-get install libglu1-mesa-dev

    After that also , i got the following error. i am unable to build and run my application.

    jsulmJ 1 Reply Last reply
    0
    • E eswar

      If i run the application in linux laptop. I got the following error, while builds.
      cannot find -lGL
      error: collect2: error: ld returned 1 exit status

      Based on the google search and install the following library package using command line.

      sudo apt-get install libglu1-mesa-dev

      After that also , i got the following error. i am unable to build and run my application.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @eswar

      sudo apt-get install build-essential libgl1-mesa-dev
      

      as described here https://doc.qt.io/qt-5/linux.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      2
      • jsulmJ jsulm

        @eswar

        sudo apt-get install build-essential libgl1-mesa-dev
        

        as described here https://doc.qt.io/qt-5/linux.html

        E Offline
        E Offline
        eswar
        wrote on last edited by
        #3

        @jsulm

        ya tried, It also installed already. I tried most of the option. i didn't find the solution for the issue.

        jsulmJ aha_1980A JonBJ 3 Replies Last reply
        0
        • E eswar

          @jsulm

          ya tried, It also installed already. I tried most of the option. i didn't find the solution for the issue.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @eswar You're building for your machine (no cross compilation)? Also try to delete build directory, run qmake and build again.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • E eswar

            @jsulm

            ya tried, It also installed already. I tried most of the option. i didn't find the solution for the issue.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @eswar Which Linux do you have?

            Type cat /etc/lsb-release in the console.

            Qt has to stay free or it will die.

            E 1 Reply Last reply
            0
            • E eswar

              @jsulm

              ya tried, It also installed already. I tried most of the option. i didn't find the solution for the issue.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @eswar
              After you have verified which distro you have as per @aha_1980's suggestion...

              Assuming you do have a locate with an up-to-date database (sudo updatedb), copy & paste:

              locate libGL.so
              

              I'd expect it to come up with something, probably /usr/lib/x86_64-linux-gnu/libGL.so. Make sure it does, and whatever path is included on your link path.

              E 1 Reply Last reply
              2
              • aha_1980A aha_1980

                @eswar Which Linux do you have?

                Type cat /etc/lsb-release in the console.

                E Offline
                E Offline
                eswar
                wrote on last edited by
                #7

                @aha_1980
                Hi
                I am using linux mint.. Here the console output.

                DISTRIB_ID=LinuxMint
                DISTRIB_RELEASE=19
                DISTRIB_CODENAME=tara
                DISTRIB_DESCRIPTION="Linux Mint 19 Tara"

                1 Reply Last reply
                0
                • JonBJ JonB

                  @eswar
                  After you have verified which distro you have as per @aha_1980's suggestion...

                  Assuming you do have a locate with an up-to-date database (sudo updatedb), copy & paste:

                  locate libGL.so
                  

                  I'd expect it to come up with something, probably /usr/lib/x86_64-linux-gnu/libGL.so. Make sure it does, and whatever path is included on your link path.

                  E Offline
                  E Offline
                  eswar
                  wrote on last edited by
                  #8

                  @JonB
                  Hi
                  This is the console output for locate libGL.so

                  /usr/lib/libGL.so
                  /usr/lib/i386-linux-gnu/libGL.so.1
                  /usr/lib/i386-linux-gnu/libGL.so.1.0.0
                  /usr/lib/i386-linux-gnu/libGL.so.1.distrib
                  /usr/lib/x86_64-linux-gnu/libGL.so.1
                  /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
                  /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib
                  /usr/lib/x86_64-linux-gnu/libGL.so.distrib

                  The library available in this path only . I did the following things.

                  1. Delete the build directory and build again
                  2. Unistall and install the Qt as well
                  JonBJ jsulmJ 2 Replies Last reply
                  0
                  • E eswar

                    @JonB
                    Hi
                    This is the console output for locate libGL.so

                    /usr/lib/libGL.so
                    /usr/lib/i386-linux-gnu/libGL.so.1
                    /usr/lib/i386-linux-gnu/libGL.so.1.0.0
                    /usr/lib/i386-linux-gnu/libGL.so.1.distrib
                    /usr/lib/x86_64-linux-gnu/libGL.so.1
                    /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
                    /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib
                    /usr/lib/x86_64-linux-gnu/libGL.so.distrib

                    The library available in this path only . I did the following things.

                    1. Delete the build directory and build again
                    2. Unistall and install the Qt as well
                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @eswar
                    Then, assuming it will use /usr/lib/libGL.so via library path, do a ldd /usr/lib/libGL.so and make sure all the dependency libraries exist OK.

                    1 Reply Last reply
                    0
                    • E eswar

                      @JonB
                      Hi
                      This is the console output for locate libGL.so

                      /usr/lib/libGL.so
                      /usr/lib/i386-linux-gnu/libGL.so.1
                      /usr/lib/i386-linux-gnu/libGL.so.1.0.0
                      /usr/lib/i386-linux-gnu/libGL.so.1.distrib
                      /usr/lib/x86_64-linux-gnu/libGL.so.1
                      /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
                      /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib
                      /usr/lib/x86_64-linux-gnu/libGL.so.distrib

                      The library available in this path only . I did the following things.

                      1. Delete the build directory and build again
                      2. Unistall and install the Qt as well
                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @eswar Do you use 32bit Qt or 64bit?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      E 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @eswar Do you use 32bit Qt or 64bit?

                        E Offline
                        E Offline
                        eswar
                        wrote on last edited by eswar
                        #11

                        @jsulm
                        Qt 5.11.2 and 64 bit

                        jsulmJ 1 Reply Last reply
                        0
                        • E eswar

                          @jsulm
                          Qt 5.11.2 and 64 bit

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @eswar Do you do anything special in your pro file?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          E 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @eswar Do you do anything special in your pro file?

                            E Offline
                            E Offline
                            eswar
                            wrote on last edited by
                            #13

                            @jsulm No changes in pro file

                            TEMPLATE = app

                            QT += qml quick
                            CONFIG += c++11
                            QT += charts

                            SOURCES += main.cpp
                            charts.cpp

                            RESOURCES += qml.qrc

                            Additional import path used to resolve QML modules in Qt Creator's code model

                            QML_IMPORT_PATH =

                            Default rules for deployment.

                            qnx: target.path = /tmp/$${TARGET}/bin
                            else: unix:!android: target.path = /opt/$${TARGET}/bin
                            !isEmpty(target.path): INSTALLS += target

                            HEADERS +=
                            charts.h

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              Robert Hairgrove
                              wrote on last edited by
                              #14

                              Was this ever resolved?

                              I was having the same problem just now on Ubuntu 18.04.4 after installing a recent version of the proprietary NVIDIA graphics driver. If I cd /usr/lib/x86_64-linux-gnu and look at all the libGL* files, i.e.:

                              bob@bobs-laptop:/usr/lib/x86_64-linux-gnu$ ls -l libGL.so*
                              lrwxrwxrwx 1 root root     14 Mai 10  2019 libGL.so -> libGL.so.1.0.0 <<< broken
                              lrwxrwxrwx 1 root root     14 Jul  5 14:57 libGL.so.1 -> libGL.so.1.7.0
                              -rwxr-xr-x 1 root root 685848 Jul  5 14:57 libGL.so.1.7.0
                              

                              The first link is red on black background, which is a broken link (libGL.so.1.0.0 doesn't exist because NVIDIA replaced it with 1.7.0).

                              So I created symlinks in /usr/lib and /usr/lib/x86_64-linux-gnu, i.e.:

                              sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0 libGL.so
                              

                              and then was able to build my project.

                              jsulmJ 1 Reply Last reply
                              1
                              • R Robert Hairgrove

                                Was this ever resolved?

                                I was having the same problem just now on Ubuntu 18.04.4 after installing a recent version of the proprietary NVIDIA graphics driver. If I cd /usr/lib/x86_64-linux-gnu and look at all the libGL* files, i.e.:

                                bob@bobs-laptop:/usr/lib/x86_64-linux-gnu$ ls -l libGL.so*
                                lrwxrwxrwx 1 root root     14 Mai 10  2019 libGL.so -> libGL.so.1.0.0 <<< broken
                                lrwxrwxrwx 1 root root     14 Jul  5 14:57 libGL.so.1 -> libGL.so.1.7.0
                                -rwxr-xr-x 1 root root 685848 Jul  5 14:57 libGL.so.1.7.0
                                

                                The first link is red on black background, which is a broken link (libGL.so.1.0.0 doesn't exist because NVIDIA replaced it with 1.7.0).

                                So I created symlinks in /usr/lib and /usr/lib/x86_64-linux-gnu, i.e.:

                                sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0 libGL.so
                                

                                and then was able to build my project.

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @Robert-Hairgrove said in cannot find -lGL Error:

                                Was this ever resolved?

                                Looks like Ubuntu issue, not Qt

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                2

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved