I know that there is a great amount of answers regarding this topic, however none of them helped me. I'm using Ubunty 20.04 via Oracle VM Virtual Box and I faced exactly the same error as all other people. After building Qt6 source code using official Qt manual I'm trying to run different projects to test if everything works properly. Console-type projects build and run properly. There are no errors. Unfortunately, when I try to run Widget-type application it fails with well-known error.
t.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.
My collegue, who has Qt6 working properly on his Ubuntu, saw that I don't have libqxcb.so
in the .../qtbase/plugins/platforms and shared it with me. Unfortunately, it didn't help much. Only the error message has changed a bit: it says that plugin was found, but couldn't be used.
I tried different solutions from Internet, but none of them helped. One of the most popular
sudo apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0
had no impact.
Also, there's more verbose output with environmental variable QT_DEBUG_PLUGINS=1
:
QFactoryLoader::QFactoryLoader() checking directory path "/home/curiouspan/qt6-build/qtbase/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqeglfs.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archreq": 1,
"className": "QEglFSIntegrationPlugin",
"debug": true,
"version": 393728
}
Got keys from plugin meta data QList("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archreq": 1,
"className": "QLinuxFbIntegrationPlugin",
"debug": true,
"version": 393728
}
Got keys from plugin meta data QList("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimal.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 1,
"className": "QMinimalIntegrationPlugin",
"debug": true,
"version": 393728
}
Got keys from plugin meta data QList("minimal")
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimalegl.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archreq": 1,
"className": "QMinimalEglIntegrationPlugin",
"debug": true,
"version": 393728
}
Got keys from plugin meta data QList("minimalegl")
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archreq": 1,
"className": "QOffscreenIntegrationPlugin",
"debug": true,
"version": 393728
}
Got keys from plugin meta data QList("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqvnc.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archreq": 1,
"className": "QVncIntegrationPlugin",
"debug": true,
"version": 393728
}
Got keys from plugin meta data QList("vnc")
QFactoryLoader::QFactoryLoader() looking at "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so"
Found metadata in lib /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archreq": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 393728
}
Got keys from plugin meta data QList("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/curiouspan/QtTestProjects/build-WidgetTestApp-Own_Desktop-Debug/platforms" ...
Cannot load library /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so: (libQt6XcbQpa.so.6: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so" : "Cannot load library /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so: (libQt6XcbQpa.so.6: 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.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
It shows that libQt6XcbQpa.so.6
file is missing.
After running ldd /home/curiouspan/qt6-build/qtbase/plugins/platforms/libqxcb.so
to show the dependencies, I got the following output:
linux-vdso.so.1 (0x00007fffc8770000)
libQt6XcbQpa.so.6 => not found
libQt6Gui.so.6 => /home/curiouspan/qt6-build/qtbase/plugins/platforms/../../lib/libQt6Gui.so.6 (0x00007f0873306000)
libQt6Core.so.6 => /home/curiouspan/qt6-build/qtbase/plugins/platforms/../../lib/libQt6Core.so.6 (0x00007f087295d000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f087277c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f087258a000)
libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007f0872573000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f0872436000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0872430000)
libQt6DBus.so.6 => /home/curiouspan/qt6-build/qtbase/plugins/platforms/../../lib/libQt6DBus.so.6 (0x00007f0872262000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f087222e000)
libOpenGL.so.0 => /lib/x86_64-linux-gnu/libOpenGL.so.0 (0x00007f0872202000)
So this file is really missing. What can be the potential problem and how do I fix it? Thank you in advance!