Important: Please read the Qt Code of Conduct -

missing Qt platform plugin xcb

  • 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 specific libs ...

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


    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?

  • Lifetime Qt Champion

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

  • That did it, thank you! It was missing ""

  • Lifetime Qt Champion

    super. Good found :)

  • @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 =>  (0x00007ffd6068b000) => ./ (0x00007ffa421b9000) => ./ (0x00007ffa3e54e000) => ./ (0x00007ffa3e104000) => ./ (0x00007ffa3dbfd000) => <QTDIR>/lib/ (0x00007ffa3d386000) => <QTDIR>/lib/ (0x00007ffa3cb8d000) => <QTDIR>/lib/ (0x00007ffa3c952000) => <QTDIR>/lib/ (0x00007ffa3c23e000) => /lib64/ (0x00007ffa3bf8d000) => /lib64/ (0x00007ffa3bd71000) => /lib64/ (0x00007ffa3ba69000) => /lib64/ (0x00007ffa3b766000) => /lib64/ (0x00007ffa3b550000) => /lib64/ (0x00007ffa3b18e000) => /lib64/ (0x00007ffa3af88000) => /lib64/ (0x00007ffa3ad80000) => <QTDIR>/lib/ (0x00007ffa3a7ab000) => <QTDIR>/lib/ (0x00007ffa3a44a000) => <QTDIR>/lib/ (0x00007ffa3a206000) => ./ (0x00007ffa39f94000) => ./ (0x00007ffa36a4f000) => /lib64/ (0x00007ffa3684b000) => /lib64/ (0x00007ffa36635000) => /lib64/ (0x00007ffa363e4000) => /lib64/ (0x00007ffa361e2000) => /lib64/ (0x00007ffa35eab000) => /lib64/ (0x00007ffa35c98000) => /lib64/ (0x00007ffa3595a000) => ./ (0x00007ffa354bf000) => ./ (0x00007ffa35107000) => ./ (0x00007ffa33724000)
    	/lib64/ (0x00007ffa4354d000) => /lib64/ (0x00007ffa334f9000) => /lib64/ (0x00007ffa332cb000) => /lib64/ (0x00007ffa330a6000) => /lib64/ (0x00007ffa32ea2000) => /lib64/ (0x00007ffa32c9c000) => /lib64/ (0x00007ffa32a9a000) => /lib64/ (0x00007ffa3287f000) => /lib64/ (0x00007ffa3267a000) => /lib64/ (0x00007ffa32477000) => /lib64/ (0x00007ffa32273000) => /lib64/ (0x00007ffa32065000) => /lib64/ (0x00007ffa31e5d000) => /lib64/ (0x00007ffa31c52000) => /lib64/ (0x00007ffa31a4e000) => /lib64/ (0x00007ffa31847000) => /lib64/ (0x00007ffa31624000) => /lib64/ (0x00007ffa31421000) => /lib64/ (0x00007ffa3121b000) => /lib64/ (0x00007ffa3100d000) => /lib64/ (0x00007ffa30e04000) => /lib64/ (0x00007ffa30ba3000) => /lib64/ (0x00007ffa3097d000) => /lib64/ (0x00007ffa30779000)

    If I set QT_QPA_PLATFORM_PLUGIN_PATH it works.

    -- 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?

  • 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:


    or you could binary edit, it has a setting created by Qt's installer that points to 5.6.1's prefix directory, to see it type strings | 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:


    Hope this helps!

  • @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!

Log in to reply