Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

qt

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.

When I open an old project in QtCreator and build it everything's OK.

But when I run this project it shows:

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

Available platform plugins are: linuxfb, minimal, offscreen, xcb.

Reinstalling the application may fix this problem. Aborted (core dumped)

So I googled this problem and tried everything. I installed every packages (libxcb series) but nothing can help!

Somebody help me please...

I tried your methods.

When I run ldd command in platform directory, It shows: ldd libqxcb.so under platform$

You can see that nothing is missing. And actually I have made a softlink in the platform directory called libqxcb.so. There was no libqxcb.so in my platform directory before.

And when I run ldd command to my executable. it shows: executable shot

And you can see the error when I execute this file.

like image 918
OrionNebular Avatar asked Apr 02 '15 05:04

OrionNebular


People also ask

What is QT XCB?

On Linux, the xcb QPA (Qt Platform Abstraction) platform plugin is used. It provides the basic functionality needed by Qt GUI and Qt Widgets to run against X11. Its library dependencies are described the following table.

How do you fix no QT platform plugin could be initialized error the application failed to start?

Many people reported that “This application failed to start because it could not find or load the Qt platform plugin Windows” error mainly occurs after installing a series of Windows updates. If this scenario applies to you, you can try performing a system restore or uninstalling these updates manually.

How do I install Qt plugins?

Note: You can install only plugins that are supported by your Qt Creator version. To install plugins: Select Help > About Plugins > Install Plugins. In the Source dialog, enter the path to the archive or library that contains the plugin.


2 Answers

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

export QT_PLUGIN_PATH=<qt base path>/plugins
like image 173
BillyJoe Avatar answered Nov 15 '22 09:11

BillyJoe


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).

like image 31
bweber Avatar answered Nov 15 '22 07:11

bweber