As I installed Ubuntu 22.04
and Qt 6.5.2
, I encountered an error that prevented any of my projects from running, and it did not display the output as expected.
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: vnc, minimal, wayland-egl, offscreen, xcb, vkkhrdisplay, eglfs, minimalegl, linuxfb, wayland.
I checked the /home/username/Qt/6.5.2/gcc_64/plugins/platforms/
path and underestand that all files were correct.
I also try:
export QT_QPA_PLATFORM_PLUGIN_PATH=/home/username/Qt/6.5.2/gcc_64/plugins/platforms/
But it didnt help.
To Fix this issue I add QT_DEBUG_PLUGINS = 1 in run section Build Environment
This helps me to log and see what actually happens.
from this
qt.core.plugin.factoryloader: checking directory path "/home/parisa/build-untitled1-Desktop_Qt_6_5_2_GCC_64bit-Debug/platforms" ...
qt.core.library: "/home/parisa/Qt/6.5.2/gcc_64/plugins/platforms/libqxcb.so" cannot load: Cannot load library /home/parisa/Qt/6.5.2/gcc_64/plugins/platforms/libqxcb.so: (libxcb-cursor.so.0: cannot open shared object file: No such file or directory)
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/parisa/Qt/6.5.2/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /home/parisa/Qt/6.5.2/gcc_64/plugins/platforms/libqxcb.so: (libxcb-cursor.so.0: cannot open shared object file: No such file or directory)"
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.
I underestand I need to install libxcb-cursor
sudo apt-get install libxcb-cursor0
Note that this happens only in Qt 6.5 above I didnt have this problem before.