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

QGLXContext fails to load libGL.so.1 library if there is no libGL.so symlink

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.11.0 Beta 4
    • 5.9.4, 5.10.1
    • GUI: OpenGL, QPA: X11/XCB
    • None
    • Reproduced on Debian GNU/Linux sid amd64, the original bug report was from Ubuntu 18.04 user.
    • a35c6a49c938fefbf25332cc5a2dc760f6d0c4ed

    Description

      Currently QGLXContext::getProcAddress has the following code:

      QLibrary lib(QLatin1String("GL"));
      glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
      

      This searches for a library named libGL.so. However, on Debian/Ubuntu (did not test on other distros) this file is not present unless the libglvnd-dev package is installed. That is a development package, and it will be rarely present on users’ systems. Without it, only libGL.so.1 file is present.

      This means that initializing the OpenGL context will fail in programs that are not linked to OpenGL themselves, which will result in crashes when trying to use it. I received a bug report from PyQt5 user, but there may be other affected applications.

      Here is a small example which illustrates the problem:

      #include <QtCore/QCoreApplication>
      #include <QtCore/QLibrary>
      #include <QtCore/QString>
      #include <QtCore/QTextStream>
      
      int main(int argc, char **argv) {
          QCoreApplication app(argc, argv);
          QLibrary lib(QLatin1String("GL"));
          QTextStream(stdout) << lib.load() << endl;
          return 0;
      }
      

      It prints 1 (loading successful) when libglvnd-dev is installed, and 0 (loading failed) when it is not installed.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-67537
          # Subject Branch Project Status CR V

          Activity

            People

              mandriver Dmitry Shachnev
              mandriver Dmitry Shachnev
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes