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. missing Qt platform plugin xcb
Qt 6.11 is out! See what's new in the release blog

missing Qt platform plugin xcb

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 5.7k Views 1 Watching
  • 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.
  • G Offline
    G Offline
    GregB
    wrote on last edited by
    #1

    I built an application on CentOS 7, and when I try to run it on a non-development CentOS 7 machine, I get the following error:

    This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".
    
    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.
    

    Within my application's directory, I have distributed the following files:

    Application
    Application.sh
    libQt5Core.so.5
    libQt5DBus.so.5
    libQt5Gui.so.5
    libQt5Network.so.5
    libQt5Widgets.so.5
    libxcb.so
    libicu*
    ... application specific libs ...
    platforms/libqeglfs.so
    platforms/libqlinuxfb.so
    platforms/libqminimal.so
    platforms/libqminimalegl.so
    platforms/libqoffscreen.so
    platforms/libqxcb.so

    Within Application.sh, it sets the path to look for application libraries within the same directory:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
    ./Application
    
    

    I've seen this question asked many times before, but none of those solutions seem to fix this problem. It seems to be finding the xcb platform, because it identifies it as available. Why does it give an error?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Have you tried to see with ldd if it misses a plugin or so file for
      xcb on the machine where it dont start.

      Z 1 Reply Last reply
      1
      • G Offline
        G Offline
        GregB
        wrote on last edited by
        #3

        That did it, thank you! It was missing "libQt5XcbQpa.so.5"

        mrjjM 1 Reply Last reply
        1
        • G GregB

          That did it, thank you! It was missing "libQt5XcbQpa.so.5"

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @GregB
          super. Good found :)

          1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Have you tried to see with ldd if it misses a plugin or so file for
            xcb on the machine where it dont start.

            Z Offline
            Z Offline
            zd3nik
            wrote on last edited by
            #5

            @mrjj
            I am having a very similar problem. The application is built on CentOS 7. But we're also running the application on the system it was built on.

            ldd doesn't show anything missing. QTDIR is set to the qt 5.6.1 dir which contains lib, include, bin, plugins, etc.

            The error:

            $ LD_LIBRARY_PATH=. ./application
            This application failed to start because it could not find or load the Qt platform plugin "xcb"
            in "".
            
            Reinstalling the application may fix this problem.
            Aborted (core dumped)
            

            ldd output:

            $ LD_LIBRARY_PATH=. ldd ./application 
            	linux-vdso.so.1 =>  (0x00007ffd6068b000)
            	libApplication.so.1 => ./libApplication.so.1 (0x00007ffa421b9000)
            	libhunspell.so.1 => ./libhunspell.so.1 (0x00007ffa3e54e000)
            	libprotobuf.so.8 => ./libprotobuf.so.8 (0x00007ffa3e104000)
            	libopencv_core.so.3.0 => ./libopencv_core.so.3.0 (0x00007ffa3dbfd000)
            	libQt5Widgets.so.5 => <QTDIR>/lib/libQt5Widgets.so.5 (0x00007ffa3d386000)
            	libQt5Gui.so.5 => <QTDIR>/lib/libQt5Gui.so.5 (0x00007ffa3cb8d000)
            	libQt5Xml.so.5 => <QTDIR>/lib/libQt5Xml.so.5 (0x00007ffa3c952000)
            	libQt5Core.so.5 => <QTDIR>/lib/libQt5Core.so.5 (0x00007ffa3c23e000)
            	libGL.so.1 => /lib64/libGL.so.1 (0x00007ffa3bf8d000)
            	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffa3bd71000)
            	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ffa3ba69000)
            	libm.so.6 => /lib64/libm.so.6 (0x00007ffa3b766000)
            	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ffa3b550000)
            	libc.so.6 => /lib64/libc.so.6 (0x00007ffa3b18e000)
            	libuuid.so.1 => /lib64/libuuid.so.1 (0x00007ffa3af88000)
            	librt.so.1 => /lib64/librt.so.1 (0x00007ffa3ad80000)
            	libQt5XmlPatterns.so.5 => <QTDIR>/lib/libQt5XmlPatterns.so.5 (0x00007ffa3a7ab000)
            	libQt5Network.so.5 => <QTDIR>/lib/libQt5Network.so.5 (0x00007ffa3a44a000)
            	libQt5Sql.so.5 => <QTDIR>/lib/libQt5Sql.so.5 (0x00007ffa3a206000)
            	libssl.so.1.0.0 => ./libssl.so.1.0.0 (0x00007ffa39f94000)
            	libcrypto.so.1.0.0 => ./libcrypto.so.1.0.0 (0x00007ffa36a4f000)
            	libdl.so.2 => /lib64/libdl.so.2 (0x00007ffa3684b000)
            	libz.so.1 => /lib64/libz.so.1 (0x00007ffa36635000)
            	libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007ffa363e4000)
            	libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007ffa361e2000)
            	libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007ffa35eab000)
            	libXext.so.6 => /lib64/libXext.so.6 (0x00007ffa35c98000)
            	libX11.so.6 => /lib64/libX11.so.6 (0x00007ffa3595a000)
            	libicui18n.so.56 => ./libicui18n.so.56 (0x00007ffa354bf000)
            	libicuuc.so.56 => ./libicuuc.so.56 (0x00007ffa35107000)
            	libicudata.so.56 => ./libicudata.so.56 (0x00007ffa33724000)
            	/lib64/ld-linux-x86-64.so.2 (0x00007ffa4354d000)
            	libexpat.so.1 => /lib64/libexpat.so.1 (0x00007ffa334f9000)
            	libglapi.so.0 => /lib64/libglapi.so.0 (0x00007ffa332cb000)
            	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007ffa330a6000)
            	libXdamage.so.1 => /lib64/libXdamage.so.1 (0x00007ffa32ea2000)
            	libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007ffa32c9c000)
            	libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007ffa32a9a000)
            	libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007ffa3287f000)
            	libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007ffa3267a000)
            	libxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007ffa32477000)
            	libxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007ffa32273000)
            	libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007ffa32065000)
            	libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007ffa31e5d000)
            	libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007ffa31c52000)
            	libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007ffa31a4e000)
            	libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007ffa31847000)
            	libxcb.so.1 => /lib64/libxcb.so.1 (0x00007ffa31624000)
            	libxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007ffa31421000)
            	libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007ffa3121b000)
            	libdrm.so.2 => /lib64/libdrm.so.2 (0x00007ffa3100d000)
            	libffi.so.6 => /lib64/libffi.so.6 (0x00007ffa30e04000)
            	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007ffa30ba3000)
            	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007ffa3097d000)
            	libXau.so.6 => /lib64/libXau.so.6 (0x00007ffa30779000)
            

            If I set QT_QPA_PLATFORM_PLUGIN_PATH it works.

            QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins LD_LIBRARY_PATH=. ./application
            -- application runs without errors --
            

            This started happening when we switched from qt 5.2.1 to 5.6.1-1. We would build qt 5.2.1 ourselves from source (so we could link our own build of SSL libs). On 5.6.1 we're using the qt installer to get the libs instead of building them ourselves because we no longer need to use custom built SSL libs.

            We have a plugins directory relative to the application binary. So I thought maybe that was confusing Qt's plugin path search, so I've tried linking the content of QTDIR/plugins into the application plugins directory:

            ln -s $QTDIR/plugins/* ./plugins/
            

            But that didn't work. The only thing I've found, so far, that works is setting QT_QPA_PLATFORM_PLUGIN_PATH. We can do that, but it seems like there's something wrong here and I'd like to figure out what it is.

            Any ideas?

            1 Reply Last reply
            0
            • hskoglundH Offline
              hskoglundH Offline
              hskoglund
              wrote on last edited by
              #6

              Hi, there are several other options available to fix this, for example, you could create a qt.conf file (and place it next to your application's .exe file) with this content:

              [Paths]
              Plugins=plugins
              

              or you could binary edit libQt5Core.so.5, it has a setting created by Qt's installer that points to 5.6.1's prefix directory, to see it type strings libQt5Core.so.5 | grep prfxpath
              (Qt adds plugins to that path to get 5.6.1's plugins)

              or you could do a call to QCoreApplication::addLibraryPath("plugins"); just before QApplication a(argc, argv); in your main.cpp

              and as a final option, which might be the easiest, instead of having a directory structure with a plugins directory containing the platforms subdirectory etc.. move all those subdirectories up one level, so that there is a platforms directory visible from your application's .exe file.
              (That would be equivalent of creating a qt.conf file with this contents:

              [Paths]
              Plugins=.
              

              Hope this helps!

              Z 1 Reply Last reply
              2
              • hskoglundH hskoglund

                Hi, there are several other options available to fix this, for example, you could create a qt.conf file (and place it next to your application's .exe file) with this content:

                [Paths]
                Plugins=plugins
                

                or you could binary edit libQt5Core.so.5, it has a setting created by Qt's installer that points to 5.6.1's prefix directory, to see it type strings libQt5Core.so.5 | grep prfxpath
                (Qt adds plugins to that path to get 5.6.1's plugins)

                or you could do a call to QCoreApplication::addLibraryPath("plugins"); just before QApplication a(argc, argv); in your main.cpp

                and as a final option, which might be the easiest, instead of having a directory structure with a plugins directory containing the platforms subdirectory etc.. move all those subdirectories up one level, so that there is a platforms directory visible from your application's .exe file.
                (That would be equivalent of creating a qt.conf file with this contents:

                [Paths]
                Plugins=.
                

                Hope this helps!

                Z Offline
                Z Offline
                zd3nik
                wrote on last edited by
                #7

                @hskoglund

                Ah! I wasn't aware the installer embeds paths into the shared objects. I moved the files around a bit after the install so now they've got invalid paths in them.

                Thanks for the info!

                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