qt.qpa.xcb: could not connect to display
-
This one is odd.
I'm building my code from VS2022 using CMake connecting to an Ubuntu Linux 22.04 virtual machine to build and debug the code.
The code builds just fine and if I open a terminal window on the Linux, the compiled executable runs just fine.
Of OTOH I try to debug it using Visual Studio, I get:
2024-11-23T00-45-33Z qt.qpa.xcb: could not connect to display qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin. 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, wayland, xcb, vkkhrdisplay, offscreen, vnc, wayland-egl, linuxfb, minimal, minimalegl.
libxcb-cursor0 is installed.
I set QT_DEBUG_PLUGINS to 1 in an attempt to debug this, but while VS showed a lot of output, I was unable to select it and copy it.
UPDATE: I managed to get VS to create a log file:
01:53:38.1622445 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: '2024-11-23T01-53-37Z ' 01:53:38.2316789 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: checking directory path "/opt/Qt/6.8.0/gcc_64/plugins/platforms" ... ' 01:53:38.2316789 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qvnc.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqeglfs.so" ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqeglfs.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "eglfs" ] }, "archlevel": 1, "className": "QEglFSIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("eglfs") ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qminimal.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qminimalegl.debug" ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-generic.so" ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqwayland-generic.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland" ] }, "archlevel": 1, "className": "QWaylandIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland") ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqxcb.so" ' 01:53:38.2326792 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqxcb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "xcb" ] }, "archlevel": 1, "className": "QXcbIntegrationPlugin", "debug": false, "version": 395264 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("xcb") ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqvkkhrdisplay.so" ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqvkkhrdisplay.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vkkhrdisplay" ] }, "archlevel": 1, "className": "QVkKhrDisplayIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vkkhrdisplay") ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qoffscreen.debug" ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: "The shared library was not found." not a plugin ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qvkkhrdisplay.debug" ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: "The shared library was not found." not a plugin ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qeglfs.debug" ' 01:53:38.2336802 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: "The shared library was not found." not a plugin ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqoffscreen.so" ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqoffscreen.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "archlevel": 1, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen") ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqvnc.so" ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqvnc.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vnc" ] }, "archlevel": 1, "className": "QVncIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vnc") ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqwayland-egl.so" ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqwayland-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-egl" ] }, "archlevel": 1, "className": "QWaylandEglPlatformIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2346759 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl") ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qlinuxfb.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqlinuxfb.so" ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqlinuxfb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "linuxfb" ] }, "archlevel": 1, "className": "QLinuxFbIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("linuxfb") ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "qxcb.debug" ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: "The shared library was not found." not a plugin ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqminimal.so" ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqminimal.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "archlevel": 1, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal") ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: looking at "libqminimalegl.so" ' 01:53:38.2356772 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.loader: Found metadata in lib /opt/Qt/6.8.0/gcc_64/plugins/platforms/libqminimalegl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimalegl" ] }, "archlevel": 1, "className": "QMinimalEglIntegrationPlugin", "debug": false, "version": 395264 } ' 01:53:38.2366778 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimalegl") ' 01:53:38.2366778 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.plugin.factoryloader: checking directory path "/home/amonra/.vs/DSS/out/build/DeepSkyStacker/platforms" ... ' 01:53:38.6570839 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.core.library: "/opt/Qt/6.8.0/gcc_64/plugins/platforms/libqxcb.so" loaded library ' 01:53:38.6590503 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.qpa.xcb: could not connect to display ' 01:53:38.6590503 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin. ' 01:53:38.6590503 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: 'qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. ' 01:53:38.6590503 [Info, Thread 364] liblinux.Shell.StreamingShell: Received: '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, wayland, xcb, vkkhrdisplay, offscreen, vnc, wayland-egl, linuxfb, minimal, minimalegl. '
Any suggestions are most welcome. FWIW I didn't have this problem when building and debugging under WSL.
-
-
Aha! Thank you. Setting DISPLAY to :0 in the SSH debug settings (launch.vs.json) accessed via "Debug and Launch Settings" did the trick:
{ "version": "0.2.1", "defaults": {}, "configurations": [ { "type": "cppgdb", "name": "DeepSkyStacker", "project": "CMakeLists.txt", "projectTarget": "DeepSkyStacker", "comment": "Learn how to configure remote debugging. For more info, see http://aka.ms/vslinuxdebug", "debuggerConfiguration": "gdb", "MIMode": "gdb", "args": [], "env": { "DISPLAY": ":0" } } ] }
The program now runs and displays on the Linux desktop. As this is windows it's easier to work that way than to run an X Server on Windows and funnel it through ssh.