Ubuntu 24.04 在线安装 Qt 6.10.2 后 Qt Creator 无法启动问题记录与解决

📌 问题背景

在 Ubuntu 24.04(Wayland 环境)中通过在线安装器安装 Qt 6.10.2 后,启动 Qt Creator 时出现如下错误:

复制代码
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.
Reinstalling the application may fix this problem.

Available platform plugins are:
xcb, eglfs, vnc, wayland-brcm, wayland-egl, wayland, linuxfb,
vkkhrdisplay, minimal, minimalegl, offscreen.

🔍 问题分析

从报错可以提取两个关键信息:

1️⃣ Qt 找到了 xcb 插件,但无法加载

复制代码
Could not load the Qt platform plugin "xcb"

说明:

  • 插件存在 ✔️
  • 但依赖库缺失 ❌

2️⃣ Qt 6.5+ 新增依赖提示(关键)

复制代码
From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed...

👉 这是核心原因!

Qt 6.5 开始

  • xcb 插件新增依赖:libxcb-cursor0
  • 如果系统未安装,会直接导致 Qt 应用(包括 Qt Creator)启动失败

⚠️ 为什么在 Wayland 环境也会报这个错?

即使系统是 Wayland:

  • Qt 默认仍然优先尝试加载 xcb(X11)插件
  • 或在初始化阶段检查其依赖
  • 如果依赖缺失 → 直接崩溃

👉 所以这不是 Wayland 配置问题,而是系统库缺失问题


✅ 解决方案

只需安装缺失依赖:

bash 复制代码
sudo apt install libxcb-cursor0

🚀 验证结果

安装完成后:

bash 复制代码
qtcreator

👉 Qt Creator 可以正常启动 ✅


💡 补充建议

为了避免类似问题,建议在 Ubuntu 上安装 Qt 后补齐常见依赖:

bash 复制代码
sudo apt install \
    libxcb-cursor0 \
    libxcb-xinerama0 \
    libxkbcommon-x11-0

🧾 总结

问题 原因 解决
Qt Creator 无法启动 Qt 6.5+ 新增依赖缺失 安装 libxcb-cursor0
报错 xcb 插件加载失败 系统库不完整 补齐 xcb 相关库

📎 一句话总结

👉 Qt 6.5+ 在 Linux 上新增了 xcb 依赖(libxcb-cursor0),Ubuntu 默认未安装,需手动补齐,否则 Qt Creator 无法启动。


✍️ 后记

这个问题非常容易误导:

  • 表面看是 Wayland / Qt 配置问题 ❌
  • 实际是系统依赖缺失 ✔️

属于典型的 "插件在,但依赖不在" 场景。


如果你也在做 Qt6 + Linux 部署,这类问题基本绕不开,建议提前整理依赖清单 👍

相关推荐
Quz6 小时前
QML Hello World 入门示例
qt
Sokach10151 天前
Linux Shell 脚本从零到能用:一个新手的一天学习总结
linux
AlfredZhao2 天前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
zzzzzz3103 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
xcyxiner3 天前
DicomViewer (dcmtk读取dcm文件)5
qt
XIAOHEZIcode3 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
xcyxiner4 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner4 天前
DicomViewer (添加模型类)3
qt
xcyxiner5 天前
DicomViewer (目录调整) 2
qt
A小辣椒5 天前
TShark:Wireshark CLI 功能
linux