Fixing Missing xcb-cursor Dependency for Qt Applications on Linux
Problem Overview
After updating Qt to version 6.5.0 or newer on Linux systems (particularly Ubuntu 20.04), you may encounter an error when launching Qt-based applications:
from 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform 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.
Available platform plugins are: minimalegl, scb, eglfs, minimal, linuxfb, vkkhrdisplay, offscreen, vnc, wayland, wayland-egl.This occurs because Qt removed the internal implementation of XCB cursor handling in version 6.5 and now requires the system to provide xcb-cursor library support.
Solution
Ubuntu/Debian Systems
Install the libxcb-cursor-dev package using apt:
sudo apt update && sudo apt install libxcb-cursor-devRed Hat/Fedora Systems
Install the xcb-util-cursor package using dnf:
sudo dnf install xcb-util-cursorIf you're compiling Qt applications, you'll also need the development headers:
sudo dnf install xcb-util-cursor-develVerifying the Installation
After installing the library, confirm the shared object file is present:
ldconfig -p | grep libxcb-cursorYou should see output similar to:
libxcb-cursor.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-cursor.so.0Why This Error Occurs
Qt 6.5 introduced these changes:
- The internal XCB cursor implementation was removed
- Applications must now link against external
xcb-cursorlibraries - This reduces Qt's code maintenance overhead and leverages system libraries
Additional Troubleshooting
If the standard solution doesn't resolve your issue:
Check for existing libraries:
bashsudo find / -name "libxcb-cursor*.so*" 2>/dev/nullInstall all XCB utilities (fallback solution):
bash# Or for Red Hat systems: sudo dnf install xcb-util*
WARNING
Installing all libxcb packages is generally unnecessary and may install unused dependencies. Only use this as a last resort.
- Update LD library cache:bash
sudo ldconfig
Applications should launch correctly after installing these dependencies. If problems persist, verify your Qt installation integrity and ensure all environment paths are correctly configured.