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. qt.qpa.xcb: could not connect to display AND Failed to create OpenGL context for format QSurfaceFormat
QtWS25 Last Chance

qt.qpa.xcb: could not connect to display AND Failed to create OpenGL context for format QSurfaceFormat

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
qt 5deploy
8 Posts 4 Posters 4.0k 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.
  • J Offline
    J Offline
    johnyboy
    wrote on 12 Jul 2020, 15:22 last edited by johnyboy 7 Dec 2020, 15:30
    #1

    I get the following error upon deploying on target (debug mode):

    17:12:34: Starting /root/p3 ...
    QML debugging is enabled. Only use this in a safe environment.
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimal.so"
    Found metadata in lib /usr/lib/plugins/platforms/libqminimal.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimal"
    ]
    },
    "archreq": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /usr/lib/plugins/platforms/libqoffscreen.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "offscreen"
    ]
    },
    "archreq": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqvnc.so"
    Found metadata in lib /usr/lib/plugins/platforms/libqvnc.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "vnc"
    ]
    },
    "archreq": 0,
    "className": "QVncIntegrationPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqxcb.so"
    Found metadata in lib /usr/lib/plugins/platforms/libqxcb.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "xcb"
    ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/root/platforms" ...
    loaded library "/usr/lib/plugins/platforms/libqxcb.so"
    qt.qpa.xcb: could not connect to display
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: minimal, offscreen, vnc, xcb.

    17:12:34: Remote process crashed.

    Also, if I use "Release" mode I get infinite warnings stating qml_qmcache not found

    So then I've tried using -platform offscreen and then I got the following error:

    loaded library "/usr/lib/.../libwindowplugin.so"
    QFactoryLoader::FactoryLoader() checking dirrectory path "..."
    QFactoryLoader::FactoryLoader() checking dirrectory path "..."
    QFactoryLoader::FactoryLoader() checking dirrectory path "..."
    QFactoryLoader::FactoryLoader() checking dirrectory path "..."
    Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options ...)
    Aborted.

    The target is an rpi3.

    What seems to be the problem here?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 12 Jul 2020, 15:36 last edited by
      #2

      Hi
      Is that running Rasberry Debian with an X11 server ?

      Could be that XCB is missing
      libxcb-xinerama0-dev
      libxcb-xinerama0

      which has been the issue on some posts here regarding upgrading the os/Qt.

      Not sure it applies to the arm version but its worth a shot.

      J 1 Reply Last reply 12 Jul 2020, 15:54
      1
      • M mrjj
        12 Jul 2020, 15:36

        Hi
        Is that running Rasberry Debian with an X11 server ?

        Could be that XCB is missing
        libxcb-xinerama0-dev
        libxcb-xinerama0

        which has been the issue on some posts here regarding upgrading the os/Qt.

        Not sure it applies to the arm version but its worth a shot.

        J Offline
        J Offline
        johnyboy
        wrote on 12 Jul 2020, 15:54 last edited by
        #3

        @mrjj Hey, I've already tried installing libxcb-xinerema0 ( -dev didn't work) but this was the error still.

        M 1 Reply Last reply 12 Jul 2020, 16:07
        0
        • J johnyboy
          12 Jul 2020, 15:54

          @mrjj Hey, I've already tried installing libxcb-xinerema0 ( -dev didn't work) but this was the error still.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 12 Jul 2020, 16:07 last edited by
          #4

          @johnyboy
          Hi
          Could you try ldd on the plugin to see if something still missing ?

          (I assume its yes to X11 server etc)

          J 1 Reply Last reply 13 Jul 2020, 13:01
          1
          • M mrjj
            12 Jul 2020, 16:07

            @johnyboy
            Hi
            Could you try ldd on the plugin to see if something still missing ?

            (I assume its yes to X11 server etc)

            J Offline
            J Offline
            johnyboy
            wrote on 13 Jul 2020, 13:01 last edited by johnyboy
            #5

            @mrjj I will try and come back to you, I don't use X11 I use gles2 btw may that pose a problem?

            M 1 Reply Last reply 13 Jul 2020, 15:03
            0
            • J johnyboy
              13 Jul 2020, 13:01

              @mrjj I will try and come back to you, I don't use X11 I use gles2 btw may that pose a problem?

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 13 Jul 2020, 15:03 last edited by
              #6

              Hi
              well if you dont have any windows manager running then it will be an issue for xcb.

              P 1 Reply Last reply 15 Jul 2020, 19:37
              0
              • K Offline
                K Offline
                KH-219Design
                wrote on 13 Jul 2020, 20:15 last edited by
                #7

                I second everything @mrjj has said so far.

                It seems that the absence of a window manager might be the key issue here.

                However, in case other people end up on this page due to a matching error phrase, I will share a workaround that I encountered for OpenGL/QSurfaceFormat errors in the past.

                A couple years ago I was working on a Qt/QML project and I was using Xephyr during testing to create the X display. A subset of team members experienced an OpenGL-related issue. It seemed to depend on each person's graphics hardware. We ended up with a technical memo that said something like "when launching the app for testing, if you see any error about OpenGL, GLX, EGL, QSurface, or similar, the workaround is to install VirtualGL from virtualgl.org and insert vglrun into the command, like so:"

                    DISPLAY=:12 vglrun -- $PROJECT_HOME/build/projectname/gui/test_app &
                

                www.219design.com
                Software | Electrical | Mechanical | Product Design

                1 Reply Last reply
                1
                • M mrjj
                  13 Jul 2020, 15:03

                  Hi
                  well if you dont have any windows manager running then it will be an issue for xcb.

                  P Offline
                  P Offline
                  Pablo J. Rogina
                  wrote on 15 Jul 2020, 19:37 last edited by
                  #8

                  if you dont have any windows manager running then it will be an issue for xcb.

                  Yes, it looks like @mrjj is right here.

                  However, you could still run the Qt app in the RPi device and make it display on another machine if you connect via SSH with X Forwarding enabled.

                  $ ssh -X user@RPi /path/to/your/Qt/app -platform xcb
                  

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  2

                  7/8

                  13 Jul 2020, 20:15

                  • Login

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