Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.



  • Hello eveyone!
    I know that there is a great amount of answers regarding this topic, however none of them helped me. I'm using Ubunty 20.04 via Oracle VM Virtual Box and I faced exactly the same error as all other people.
    After building Qt6 source code using official Qt manual I'm trying to run different projects to test if everything works properly. Console-type projects build and run properly. There are no errors. Unfortunately, when I try to run Widget-type application it fails with well-known error.

    t.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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
    

    My collegue, who has Qt6 working properly on his Ubuntu, saw that I don't have libqxcb.so in the .../qtbase/plugins/platforms and shared it with me. Unfortunately, it didn't help much. Only the error message has changed a bit: it says that plugin was found, but couldn't be used.
    I tried different solutions from Internet, but none of them helped. One of the most popular

    sudo apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0
    

    had no impact.
    What can be the problem? Thank you in advance.



  • @CuriousPan
    There are many posts about this on this forum where people advise what to install, you could search. I think the most likely candidate you need to apt get is libxinerama, though it might be different for Qt6. And/or maybe libxcb-util?



  • @JonB, I tried, but it turned out to be already installed, so no effect, unfortunately.


  • Lifetime Qt Champion

    Hi,

    Then start your application with the QT_DEBUG_PLUGINS environment variable set to 1 so you'll have more information about why it's failing to load.



  • @SGaist Hello.
    Here's the more verbose output I got:

    QFactoryLoader::QFactoryLoader() checking directory path "/home/curiouspan/qt6-build/qtbase/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqeglfs.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqeglfs.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "eglfs"
            ]
        },
        "archreq": 1,
        "className": "QEglFSIntegrationPlugin",
        "debug": true,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqlinuxfb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "linuxfb"
            ]
        },
        "archreq": 1,
        "className": "QLinuxFbIntegrationPlugin",
        "debug": true,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimal.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 1,
        "className": "QMinimalIntegrationPlugin",
        "debug": true,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimalegl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimalegl"
            ]
        },
        "archreq": 1,
        "className": "QMinimalEglIntegrationPlugin",
        "debug": true,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 1,
        "className": "QOffscreenIntegrationPlugin",
        "debug": true,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqvnc.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqvnc.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vnc"
            ]
        },
        "archreq": 1,
        "className": "QVncIntegrationPlugin",
        "debug": true,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so"
    Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archreq": 0,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 393728
    }
    
    
    Got keys from plugin meta data QList("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/curiouspan/QtTestProjects/build-WidgetTestApp-Own_Desktop-Debug/platforms" ...
    Cannot load library /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so: (libQt6XcbQpa.so.6: cannot open shared object file: No such file or directory)
    QLibraryPrivate::loadPlugin failed on "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so" : "Cannot load library /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so: (libQt6XcbQpa.so.6: cannot open shared object file: No such file or directory)"
    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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
    

  • Lifetime Qt Champion

    @CuriousPan said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    QLibraryPrivate::loadPlugin failed on "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so"

    Looks like the XCB platform plug-in is missing (libqxcb.so)


  • Moderators

    @jsulm said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    Looks like the XCB platform plug-in is missing (libqxcb.so)

    Or, one of its dependencies is missing.

    1. Run ldd /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so
    2. Look for libraries that are marked "not found"
    3. Install those missing libraries.


  • Hi, or rather, if you scroll to the right, it looks like libQt6XcbQpa.so.6 is missing:
    "... Cannot load library /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so: (libQt6XcbQpa.so.6: cannot open shared object file: No such file or directory)"


  • Moderators

    @hskoglund said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    Hi, or rather, if you scroll to the right, it looks like libQt6XcbQpa.so.6 is missing:
    "... Cannot load library /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so: (libQt6XcbQpa.so.6: cannot open shared object file: No such file or directory)"

    Good spot.

    @CuriousPan, you say you built Qt from source. Check the configure summary and see if the XCB plugin was enabled.



  • @JKSH How can I do it?


  • Moderators

    @CuriousPan said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    @JKSH How can I do it?

    When you ran the configure script at the start, it should have produced some log files. Have a look at the logs.



  • @JKSH, I entered the required command and here's the output I got

    curiouspan@curiouspan-VirtualBox:~$ ldd /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so
    	linux-vdso.so.1 (0x00007fffc8770000)
    	libQt6XcbQpa.so.6 => not found
    	libQt6Gui.so.6 => /home/curiouspan/qt6-build/qtbase/plugins/platforms/../../lib/libQt6Gui.so.6 (0x00007f0873306000)
    	libQt6Core.so.6 => /home/curiouspan/qt6-build/qtbase/plugins/platforms/../../lib/libQt6Core.so.6 (0x00007f087295d000)
    	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f087277c000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f087258a000)
    	libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007f0872573000)
    	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f0872436000)
    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0872430000)
    	libQt6DBus.so.6 => /home/curiouspan/qt6-build/qtbase/plugins/platforms/../../lib/libQt6DBus.so.6 (0x00007f0872262000)
    	libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f087222e000)
    	libOpenGL.so.0 => /lib/x86_64-linux-gnu/libOpenGL.so.0 (0x00007f0872202000)
    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f08721dd000)
    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f087208e000)
    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0872073000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007f08742b7000)
    	libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f0871fbb000)
    	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f0871f91000)
    	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f0871f89000)
    	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f0871f81000)
    	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f0871f67000)
    
    

    How can I install this libQt6XcbQpa.so.6?



  • @CuriousPan
    @JKSH asked you to look at your configure log to see what you had set to build, since you are building Qt6 yourself, not downloading it.


  • Moderators

    @CuriousPan said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    How can I install this libQt6XcbQpa.so.6?

    This is part of Qt.

    Since your build was missing libQt6XcbQpa.so and libqxcb.so, it probably means your system did not fulfil the requirements to build Qt's XCB plugin (again, check your configure log)

    You might be able to get a copy of libQt6XcbQpa.so from your colleague, but it would be better to find out why it didn't build in the first place.



  • @JKSH Where this file should be located? My collegue cannot find it.



  • @JonB, how can I see configure log? Is there some log file?


  • Lifetime Qt Champion

    @CuriousPan said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    how can I see configure log? Is there some log file?

    Its config.log text file in the folder where you called configure...



  • @jsulm, undertood. Anyway, do you know where the mentioned libQt6XcbQpa.so can be located? My collegue cannot find it.



  • @jsulm, Hello.
    I have found configure.summary file. Here's the content for it. Is this what you meant?

    Building for: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Compiler: gcc 9.3.0
    Build options:
      Mode ................................... debug
      Optimize debug build ................... no
      Fully optimize release builds (-O3) .... no
      Building shared libraries .............. yes
      Using C standard ....................... C11
      Using C++ standard ..................... C++17
      Using ccache ........................... no
      Using new DTAGS ........................ yes
      Generating GDB index ................... no
      Relocatable ............................ yes
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
        AVX .................................. AVX AVX2
        AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
        Other x86 ............................ AES F16C RDRAND SHA
        Intrinsics without compiler architecture option  yes
      Sanitizers:
        Addresses ............................ no
        Threads .............................. no
        Memory ............................... no
        Fuzzer (instrumentation only) ........ no
        Undefined ............................ no
      Build parts ............................ libs tools
    Qt modules and options:
      Qt Concurrent .......................... yes
      Qt D-Bus ............................... yes
      Qt D-Bus directly linked to libdbus .... no
      Qt Gui ................................. yes
      Qt Network ............................. yes
      Qt Sql ................................. yes
      Qt Testlib ............................. yes
      Qt Widgets ............................. yes
      Qt Xml ................................. yes
    Support enabled for:
      Using pkg-config ....................... yes
      udev ................................... no
      Using system zlib ...................... no
      Zstandard support ...................... no
      Thread support ......................... yes
    Qt Core:
      backtrace .............................. yes
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ no
      GLib ................................... no
      ICU .................................... no
      Using system libb2 ..................... no
      Built-in copy of the MIME database ..... yes
      Tracing backend ........................ <none>
      Logging backends:
        journald ............................. no
        syslog ............................... no
        slog2 ................................ no
      PCRE2 .................................. yes
        Using system PCRE2 ................... no
      CLONE_PIDFD support in forkfd .......... yes
    Qt Sql:
      SQL item models ........................ yes
    Qt Network:
      getifaddrs() ........................... yes
      IPv6 ifname ............................ yes
      libproxy ............................... no
      Linux AF_NETLINK ....................... yes
      OpenSSL ................................ no
        Qt directly linked to OpenSSL ........ no
      OpenSSL 1.1 ............................ no
      DTLS ................................... no
      OCSP-stapling .......................... no
      SCTP ................................... no
      Use system proxies ..................... yes
      GSSAPI ................................. no
      Brotli Decompression Support ........... no
    Qt Gui:
      Accessibility .......................... yes
      FreeType ............................... yes
        Using system FreeType ................ no
      HarfBuzz ............................... yes
        Using system HarfBuzz ................ no
      Fontconfig ............................. no
      Image formats:
        GIF .................................. yes
        ICO .................................. yes
        JPEG ................................. yes
          Using system libjpeg ............... no
        PNG .................................. yes
          Using system libpng ................ no
      Text formats:
        HtmlParser ........................... yes
        CssParser ............................ yes
        OdfWriter ............................ yes
        MarkdownReader ....................... yes
          Using system libmd4c ............... no
        MarkdownWriter ....................... yes
      EGL .................................... yes
      OpenVG ................................. no
      OpenGL:
        Desktop OpenGL ....................... yes
        OpenGL ES 2.0 ........................ no
        OpenGL ES 3.0 ........................ no
        OpenGL ES 3.1 ........................ no
        OpenGL ES 3.2 ........................ no
      Vulkan ................................. no
      Session Management ..................... yes
    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... no
      INTEGRITY HID .......................... no
      mtdev .................................. no
      tslib .................................. no
      xkbcommon .............................. no
      X11 specific:
        XLib ................................. yes
        XCB Xlib ............................. no
        EGL on X11 ........................... yes
        xkbcommon-x11 ........................ no
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. yes
      EGLFS details:
        EGLFS OpenWFD ........................ no
        EGLFS i.Mx6 .......................... no
        EGLFS i.Mx6 Wayland .................. no
        EGLFS RCAR ........................... no
        EGLFS EGLDevice ...................... no
        EGLFS GBM ............................ no
        EGLFS VSP2 ........................... no
        EGLFS Mali ........................... no
        EGLFS Raspberry Pi ................... no
        EGLFS X11 ............................ no
      LinuxFB ................................ yes
      VNC .................................... yes
      VK_KHR_display ......................... no
      QNX:
        lgmon ................................ no
        IMF .................................. no
      XCB:
        Using system-provided xcb-xinput ..... no
        GL integrations:
          GLX Plugin ......................... no
            XCB GLX .......................... no
          EGL-X11 Plugin ..................... yes
      Windows:
        Direct 2D ............................ no
        Direct 2D 1.1 ........................ no
        DirectWrite .......................... no
        DirectWrite 3 ........................ no
    Qt Widgets:
      GTK+ ................................... no
      Styles ................................. Fusion Windows
    Qt Testlib:
      Tester for item models ................. yes
    Qt PrintSupport:
      CUPS ................................... no
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite ................................. yes
        Using system provided SQLite ......... no
    Core tools:
      qmake tool ............................. yes
    Qt QML:
      QML network support .................... yes
      QML debugging and profiling support .... yes
      QML just-in-time compiler .............. yes
      QML sequence object .................... yes
      QML XML http request ................... yes
      QML Locale ............................. yes
    Qt QML Models:
      QML list model ......................... yes
      QML delegate model ..................... yes
    Qt Quick:
      AnimatedImage item ..................... yes
      Canvas item ............................ yes
      Support for Qt Quick Designer .......... yes
      Flipable item .......................... yes
      GridView item .......................... yes
      ListView item .......................... yes
      TableView item ......................... yes
      Path support ........................... yes
      PathView item .......................... yes
      Positioner items ....................... yes
      Repeater item .......................... yes
      ShaderEffect item ...................... yes
      Sprite item ............................ yes
    Qt Quick Templates 2:
      Hover support .......................... yes
      Multi-touch support .................... yes
    Qt Quick Controls 2:
      Styles ................................. Basic Fusion Imagine Material Universal macOS Windows
    

  • Moderators

    @CuriousPan said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    Features used by QPA backends:
    ...
      xkbcommon .............................. no
      X11 specific:
        XLib ................................. yes
        XCB Xlib ............................. no
        EGL on X11 ........................... yes
        xkbcommon-x11 ........................ no
    ...
    QPA backends:
    ...
      XCB:
        Using system-provided xcb-xinput ..... no
        GL integrations:
          GLX Plugin ......................... no
            XCB GLX .......................... no
          EGL-X11 Plugin ..................... yes
    

    You need "yes" on all of these. "no" means you were missing the dependencies.

    You should:

    1. Clean out your build tree (i.e. delete all files that were not part of the original source code)
    2. Install all the dependencies for Ubuntu at https://wiki.qt.io/Building_Qt_5_from_Git (pay particular attention to the "Libxcb" section)
    3. Run configure again. Make sure you get "yes" on all of the above.
    4. Run make to build Qt.

    You should now have all the XCB-related libraries.



  • @JKSH, thank you for response. I will try mentioned steps. But is it relevant for Qt6 too?


  • Moderators

    @CuriousPan said in qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.:

    @JKSH, thank you for response. I will try mentioned steps. But is it relevant for Qt6 too?

    You're welcome.

    Yes, I believe the XCB requirements for Qt 5 and Qt 6 are very similar (or even identical)



  • @JKSH, thank you for your help. Your advice solved my problems. Steps from the link installed dependencies properly and now everything runs perfectly.


Log in to reply