Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89857

linker warning on Ubuntu 20.04 LTS (libOpenGL.so.0 needed)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.0.0
    • Build System: CMake
    • Linux/X11

    Description

      when linking via QtCreator this message is printed
      `/usr/bin/ld: warning: libOpenGL.so.0, needed by <project-path>/lib/libQt6Widgets.so.6.0.0, not found (try using -rpath or -rpath-link)`

      running `eu-readelf d <projectpath>/lib/libQt6Widgets.so.6.0.0` reveals following 

      Dynamic segment contains 41 entries:
       Addr: 0x00000000008e9658  Offset: 0x6e9658  Link to section: [ 4] '.dynstr'
        Type              Value
        NEEDED            Shared library: [libQt6Gui.so.6]
        NEEDED            Shared library: [libGLX.so.0]
        NEEDED            Shared library: [libOpenGL.so.0]
        NEEDED            Shared library: [libQt6Core.so.6]
        NEEDED            Shared library: [libpthread.so.0]
        NEEDED            Shared library: [libxkbcommon.so.0]
        NEEDED            Shared library: [libstdc++.so.6]
        NEEDED            Shared library: [libm.so.6]
        NEEDED            Shared library: [libgcc_s.so.1]
        NEEDED            Shared library: [libc.so.6]
        SONAME            Library soname: [libQt6Widgets.so.6]
        RPATH             Library rpath: [$ORIGIN]
        INIT              0x00000000001647c8
        FINI              0x000000000055dc80
        INIT_ARRAY        0x00000000008b9100
        INIT_ARRAYSZ      56 (bytes)
        FINI_ARRAY        0x00000000008b9138
        FINI_ARRAYSZ      8 (bytes)
        GNU_HASH          0x00000000000001f0
        STRTAB            0x0000000000052c40
        SYMTAB            0x0000000000012680
        STRSZ             455183 (bytes)
        SYMENT            24 (bytes)
        PLTGOT            0x00000000008eb000
        PLTRELSZ          53208 (bytes)
        PLTREL            RELA
        JMPREL            0x00000000001577f0
        RELA              0x00000000000c75f8
        RELASZ            590328 (bytes)
        RELAENT           24 (bytes)
        VERDEF            0x00000000000c7420
        VERDEFNUM         4
        VERNEED           0x00000000000c7498
        VERNEEDNUM        7
        VERSYM            0x00000000000c1e50
        RELACOUNT         20469
        NULL              
        NULL              
        NULL              
        NULL              
        NULL
      

      According to a user on the 'Cpplang' Slack the wrong library is referenced. Instead of 'libOpenGL.so.0' it should be 'libGL.so'

      the same user pointed out that the potential issue is in the CMake setup here
      https://github.com/qt/qtbase/blob/dev/src/gui/CMakeLists.txt#L3

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              thomas_wollenzin Thomas Wollenzin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes