Skip to content

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:

bash
sudo apt update && sudo apt install libxcb-cursor-dev

Red Hat/Fedora Systems

Install the xcb-util-cursor package using dnf:

bash
sudo dnf install xcb-util-cursor

If you're compiling Qt applications, you'll also need the development headers:

bash
sudo dnf install xcb-util-cursor-devel

Verifying the Installation

After installing the library, confirm the shared object file is present:

bash
ldconfig -p | grep libxcb-cursor

You should see output similar to:

libxcb-cursor.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-cursor.so.0

Why This Error Occurs

Qt 6.5 introduced these changes:

  • The internal XCB cursor implementation was removed
  • Applications must now link against external xcb-cursor libraries
  • This reduces Qt's code maintenance overhead and leverages system libraries

Additional Troubleshooting

If the standard solution doesn't resolve your issue:

  1. Check for existing libraries:

    bash
    sudo find / -name "libxcb-cursor*.so*" 2>/dev/null
  2. Install 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.

  1. 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.