(Qt 5.4.1) This application failed to start because it could not find or load the Qt platform plugin “xcb”

前端 未结 9 1474
陌清茗
陌清茗 2020-11-30 11:57

I reinstalled my ubuntu 14.04 and Qt 5.4.1 and Qtcreator.

Qt 5.4.1 was built from source with \"-opensource -nomake-test -nomake-example\" configure options.

相关标签:
9条回答
  • 2020-11-30 12:45

    'This application failed to start because it could not find or load the Qt platform plugin "xcb".'

    See the accompanying web page, scroll down to heading "Qt Plugins". See first paragraph.

    libqxcb.so is required, even if you link the rest statically.

    http://doc.qt.io/qt-5/linux-deployment.html#application-dependencies

    Qt have probably written their source code software to work in the following way: Instead of allowing libqxcb.so to be loaded at startup automatically (using rpath's) they use a dlopen() function to load it, as part of their QPA function set, soon after main() begins.

    So this completely disregards our attempt to include all the "xcb" functions statically.

    If their dlopen() fails they just trot out their error message we all know and hate, and then call signal 6 to abort it (quite unnecessarily) instead of exiting normally.

    0 讨论(0)
  • 2020-11-30 12:46

    Try to go to the platforms folder of the Qt installation your program is using and run ldd libqxcb.so in a command prompt. Then check in the output if there are any missing dependencies. If the libqxcb.so is missing one of its dependencies this produces the output you mentioned.

    You can also use the ldd command on your executable to check if there are any dependencies that can not be found.

    Here is an example of what missing dependencies look like in the ldd output:

    Example of <code>ldd</code> output

    PS: the accepted answer of this question might also help you (creating a qt.conf file).

    0 讨论(0)
  • 2020-11-30 12:49

    For a similar issue, in my case I solved with:

    export QT_PLUGIN_PATH=<qt base path>/plugins
    
    0 讨论(0)
提交回复
热议问题