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. Ubuntu: "QOpenGLShaderProgram shader program is not linked"
QtWS25 Last Chance

Ubuntu: "QOpenGLShaderProgram shader program is not linked"

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 4.1k Views
  • 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.
  • D Offline
    D Offline
    dcortesi
    wrote on 14 Jul 2017, 20:44 last edited by dcortesi
    #1

    The app is written in PyQt and Qt both version 5.9. The app runs correctly on Mac OS X. (Edit: the app also runs correctly on Windows 7.) Moving the same source code to a linux system running 64-bit Ubuntu, the app displays a solid-black window and produces many multiple error sequences like:

    QOpenGLShaderProgram::uniformLocation(qt_Matrix): shader program is not linked
    QOpenGLShaderProgram: could not create shader program
    QOpenGLShader: could not create shader
    shader compilation failed: ""
    

    There is no explicit use of OpenGL in the program, it uses just standard widgets, QMainWindow, QListView, and QWebEngineView.

    How do I tell it to quit trying to use OpenGL? Is there a style setting or something I can give to QApplication?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dcortesi
      wrote on 18 Jul 2017, 17:55 last edited by
      #2

      This problem is a specific Linux problem when the local graphics drivers are NVIDIA, but the linked libGL.so is not the NVIDIA version.

      This is the Ubuntu bug that explains the issue, it is 4 years old!

      People on the PyQt mailing list provided this info, and suggested a simple work-around. Add the following code early in the setup of the app:

      if sys.platform.startswith( 'linux' ) :
          from OpenGL import GL
      

      The GL module will import the correct (openGL.so.1) dll. Another suggested approach was to use ctypes,

      import ctypes
      ctypes.cdll.LoadLibrary("libGL.so.1")
      

      I did not try this. A third approach would be to find the system libGL.so and symlink it to libGL.so.1 however when I poked around the innards of Ubuntu 16 (64-bit) the number and links-between of the various libGL* files were more complicated than this simple idea would suggest so I did not try it.

      1 Reply Last reply
      0

      1/2

      14 Jul 2017, 20:44

      • Login

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