Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Can't build chip example - /usr/bin/ld: cannot find -lGL
Forum Updated to NodeBB v4.3 + New Features

Can't build chip example - /usr/bin/ld: cannot find -lGL

Scheduled Pinned Locked Moved Solved Installation and Deployment
11 Posts 2 Posters 2.1k 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.
  • Q Offline
    Q Offline
    qalex
    wrote on last edited by
    #1

    Hello.
    I just installed CentOS Linux release 7.5.1804, Qt 4.8.7 using yum (base repo) and Qt Creator 4.6.1 using online installer.
    I have NVIDIA video card on may notebook and I installed NVIDIA driver.
    Demo applications, those are provided with Qt in binary form, work fine - chip for example - and OpenGL is supported.
    But when I try to build it (chip example), I get the following linker error:

    g++  -o chip main.o mainwindow.o view.o chip.o moc_mainwindow.o moc_view.o qrc_images.o    -L/usr/lib64 -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGL -lpthread
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so when searching for -lGL
    /usr/bin/ld: skipping incompatible //lib/libGL.so when searching for -lGL
    /usr/bin/ld: skipping incompatible //usr/lib/libGL.so when searching for -lGL
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    

    I have libGL.so in /usr/lib64, I have mesa-libGL and mesa-libGL-devel packages installed.
    How to solve the problem?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Might be a silly question but are you sure you are building your application in 64bit ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        Might be a silly question but are you sure you are building your application in 64bit ?

        Q Offline
        Q Offline
        qalex
        wrote on last edited by
        #3

        @SGaist said in Can't build chip example - /usr/bin/ld: cannot find -lGL:

        Hi,

        Might be a silly question but are you sure you are building your application in 64bit ?

        Hi @SGaist, thanks for the reply first.
        I don't think your question is silly - I was also thinking about that when I saw the paths where ld was searching the lib, but ...
        I uninstalled NVIDIA driver, screen resolution on my notebook is ugly now, but chip example is compiled and linked without any errors! And when I run the chip example OpenGL is supported!
        As far as I understand, installation of NVIDIA video card driver breaks ... something in ... somewhere :) But I have no idea what and where, and how to fix it :(
        Maybe you know the way how to tell Qt to use NVIDIA driver, or OpenGL lib, or ... something to fix the problem?
        Thanks in advance for answering.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How did you install the Nvidia stuff ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 1 Reply Last reply
          0
          • SGaistS SGaist

            How did you install the Nvidia stuff ?

            Q Offline
            Q Offline
            qalex
            wrote on last edited by
            #5

            @SGaist
            I install NVIDIA driver by compiling it - I must have kernel-headers and kernel-devel packages installed. Installation is done by root on level 3 - X is not running. I installed NVIDIA driver before Qt installation.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What about the associated OpenGL libraries ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              Q 1 Reply Last reply
              0
              • SGaistS SGaist

                What about the associated OpenGL libraries ?

                Q Offline
                Q Offline
                qalex
                wrote on last edited by
                #7

                @SGaist

                Here are the libs:

                [user@centos-7 ~]$ ls -h /usr/lib64/ | grep "libGL"
                libGLdispatch.so.0
                libGLESv1_CM_nvidia.so.1
                libGLESv1_CM_nvidia.so.390.59
                libGLESv1_CM.so
                libGLESv1_CM.so.1
                libGLESv1_CM.so.1.2.0
                libGLESv2_nvidia.so.2
                libGLESv2_nvidia.so.390.59
                libGLESv2.so
                libGLESv2.so.2
                libGLESv2.so.2.1.0
                libGL.la
                libGL.so
                libGL.so.1
                libGL.so.1.7.0
                libGLU.so
                libGLU.so.1
                libGLU.so.1.3.1
                libGLX_indirect.so.0
                libGLX_nvidia.so.0
                libGLX_nvidia.so.390.59
                libGLX.so
                libGLX.so.0
                

                Do you mean anything else?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  How did you instal them ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  Q 1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qalex
                    wrote on last edited by
                    #9

                    The problem is solved - I install NVIDIA the latest driver (version: 390.67 release Date: 2018.6.5) in this way: http://www.advancedclustering.com/act_kb/installing-nvidia-drivers-rhel-centos-7/.

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      How did you instal them ?

                      Q Offline
                      Q Offline
                      qalex
                      wrote on last edited by
                      #10

                      @SGaist said in Can't build chip example - /usr/bin/ld: cannot find -lGL:

                      How did you instal them ?

                      I download shell script from NVIDIA and started it in terminal.

                      The problem is solved by installing the latest NVIDIA drivers (version: 390.67 release Date: 2018.6.5) in that way: http://www.advancedclustering.com/act_kb/installing-nvidia-drivers-rhel-centos-7/.

                      1 Reply Last reply
                      1
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Glad you found out and thanks for sharing !

                        Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        • Login

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