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.
I just stuck into a very similar issue for hours, also nothing is "not found" in ldd
results on related executable, or libqxcb.so. finally I found it's the issue with the executable itself but not Qt. Tried QT_QPA_PLATFORM='' executable
and it works :)
I got this exact error on linux xubuntu 18.04
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized.
Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
Aborted (core dumped)
First, defining this environment variable before starting qtcreator from the commandline causes more debug to be printed out:
export QT_DEBUG_PLUGINS=1
And then in the debug it said this when trying to start qtcreator from the commandline on xubuntu 18.04:
Cannot load library /home/myuser/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)
Note that it cannot find libxkbcommon-x11, so the fix was this:
sudo apt-get install libxkbcommon-x11-dev
export PATH=$PATH:~/Qt/Tools/QtCreator/bin
Now qtcreator starts.
Execute the command :
sudo ./app-name -platform linuxfb
This might be obvious, but I got this error while running a GUI from a (displayless) SSH session [ Why? I was developing an embedded app on a much larger screen, right next to the tiny touch screen it is intended for ].
Anyhow, in bash the following command targeted the app to its own screen:
export DISPLAY=':0.0'
Hope this helps someone.
export QT_PLUGIN_PATH=<your qt installation path>/plugins/platforms
Similar to what mbjoe says, it really works!
for anyone that hasn't found the solution yet and desperately looking for an answer, this is a copy of what @wardw commented on the currently top rated answer, which helped me resolve my underlying issue.
export QT_DEBUG_PLUGINS=1
put this either in your run configuration or on the console before running your project and it will print more information about what is wrong.