'ncu-ui won't run: Could not load the Qt platform plugin "xcb" in "" even though it was found

I'm trying to run the ncu-ui profiler GUI on a CentOS 7 Linux system (using ncu-ui 2022.1), both as root and as a regular user. I'm getting the error:

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: xcb.

I've installed a bunch of xcb libraries, and the problem doesn't go away. What should I do?



Solution 1:[1]

tl;dr: Install libxkbcommon-x11.

If you'll note the end of the error message, it says:

Application could not be initialized!
    This is likely due to missing Qt platform dependencies.
    For a list of dependencies, please refer to https://doc.qt.io/qt-5/linux-requirements.html
    To view missing libraries, set QT_DEBUG_PLUGINS=1 and re-run the application.

Here's what you might get when running that:

Warning: OpenGL Version check failed. Falling back to Mesa software rendering.
QFactoryLoader::QFactoryLoader() checking directory path "/opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so"
Found metadata in lib /opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/platforms" ...
Cannot load library /opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so" : "Cannot load library /opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so: (libxkbcommon-x11.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.

Available platform plugins are: xcb.

/opt/nvidia/nsight-compute/2022.1.1/host/linux-desktop-glibc_2_11_3-x64/ncu-ui: line 26: 40098 Aborted                 (core dumped) "$NV_AGORA_PATH/CrashReporter" "NVIDIA Nsight Compute" "NVIDIA Nsight Compute" "2022.1.1.0 (build 30914944) (public-release)" "$NV_AGORA_PATH/ncu-ui.bin" "$@"

They key line is:

libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory

so, install libxkbcommon-x11 (and maybe libxkbcommon for good measure). That should do it. But - if you got a different error message about a missing file, you need to figure out which package it belongs to.

Solution 2:[2]

In my case it was missing libxcb-xinput. Therefore,

sudo apt-get install libxcb-xinput-dev

fixed the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 hpd