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.plugin: Could not find the Qt platform plugin "xcb" in ""

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""

Scheduled Pinned Locked Moved Solved Installation and Deployment
4 Posts 1 Posters 1.7k 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.
  • R Offline
    R Offline
    RobertB
    wrote on last edited by RobertB
    #1

    Trying to compile a QtWidgets application in docker, statically, using Qt 5.15.0.

    My application:

    ./helloworld
    qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
    

    In my docker container I seem to be missing libQt5XcbQpa.a

    I configure Qt5 like this:

    ./configure --prefix=/usr -platform linux-g++-64 -opensource -confirm-license -release -static -no-avx \
        -opengl desktop -qpa xcb -system-freetype -fontconfig -glib \
        -no-dbus -no-openssl -no-sql-sqlite -no-use-gold-linker \
        -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
        -skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
        -skip qtdoc -skip qtquickcontrols -skip qtquickcontrols2 -skip qtspeech  -skip qtgamepad \
        -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -optimize-size \
        -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \
        -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview \
        -skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine \
        -skip qtdeclarative -skip qtmultimedia  \
        -no-feature-cups -no-feature-ftp -no-feature-pdf -no-feature-animation \
        -nomake examples -nomake tests -nomake tools
    

    Result:

    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... no
      INTEGRITY HID .......................... no
      mtdev .................................. no
      tslib .................................. no
      xkbcommon .............................. yes
      X11 specific:
        XLib ................................. no
        XCB Xlib ............................. no
        EGL on X11 ........................... no
        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
    

    question 1: Does this look OK?

    question 2: How do I get libQt5XcbQpa ? Assuming that this produces my application's error.

    CMake also notices Qt5XcbQpa is absent:

    find_library(Qt5XcbQpa_LIBRARY Qt5XcbQpa PATHS REQUIRED)
    

    CMake Error:

    CMake Error at CMakeLists.txt:74 (find_library):
      Could not find Qt5XcbQpa_LIBRARY using the following names: Qt5XcbQpa
    
    1 Reply Last reply
    0
    • R Offline
      R Offline
      RobertB
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • R Offline
        R Offline
        RobertB
        wrote on last edited by RobertB
        #3

        I was able to get rid of the error by installing a lot of xcb libraries statically; Starting from:

        • https://gitlab.freedesktop.org/xorg/lib/libxcb
        • https://gitlab.freedesktop.org/xorg/lib/libxtrans.git
        • https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git
        • https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git
        • https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms.git
        • https://gitlab.freedesktop.org/xorg/lib/libxcb-render-util.git
        • https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git
        • https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git
        • https://gitlab.freedesktop.org/xorg/lib/libxext
        • https://gitlab.freedesktop.org/xorg/lib/libx11
        • https://gitlab.freedesktop.org/xorg/lib/libxinerama.git

        All of them (or almost?) can be compiled like:

        CFLAGS='-fPIC' CXXFLAGS='-fPIC' ./autogen.sh --disable-shared --enable-static && \
        make -j4
        make install
        

        At which point you get the necessary xcb .a libs in /usr/local/. Find the right version for each. Yes, it's a big pain.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          RobertB
          wrote on last edited by RobertB
          #4

          When I try to compile my application I now get:

          /usr/local/lib/libxcb-image.a(xcb_image.o): In function `xcb_create_pixmap_from_bitmap_data':
          xcb_image.c:(.text+0x1c69): undefined reference to `xcb_aux_create_gc'
          collect2: error: ld returned 1 exit status
          CMakeFiles/hello2.dir/build.make:310: recipe for target 'hello2' failed
          make[2]: *** [hello2] Error 1
          CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/hello2.dir/all' failed
          make[1]: *** [CMakeFiles/hello2.dir/all] Error 2
          Makefile:102: recipe for target 'all' failed
          

          I've made an issue here: https://bugreports.qt.io/browse/QTBUG-86287

          TL;DR: If you get "Could not find the Qt platform plugin "xcb"" then make sure that you have libQt5XcbQpa.a or libQt5XcbQpa.so, if that's not the case, you should compile the required xcb libraries and recompile Qt.

          1 Reply Last reply
          0

          • Login

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