Ubuntu 22.04 配置qtchooser默认启用 Qt6

文章目录

  • 问题现象
  • 解决方案
    • [系统解决方案 1. Select Qt6 system-wide](#系统解决方案 1. Select Qt6 system-wide)
    • [当前用户解决方案 2. Select Qt6 for current user only](#当前用户解决方案 2. Select Qt6 for current user only)
  • 参考资料

问题现象

In Ubuntu 22.04 there is currently an open bug QtChooser doesnt support qt6.

So even if Qt6 has been installed using sudo apt install qt6-base-dev, qtchooser -l does not list a qt6 option and qmake outputs qmake: could not find a Qt installation of ''.

Assuming Qt6 is installed and qmake6 can be called, I believe there are two options:

解决方案

系统解决方案 1. Select Qt6 system-wide

  • Generate qt6.conf based on the path to qmake6
bash 复制代码
qtchooser -install qt6 $(which qmake6)
  • Move/copy qt6.conf to system-wide dir
bash 复制代码
# sudo mv ~/.config/qtchooser/qt6.conf /usr/share/qtchooser/qt6.conf
sudo cp ~/.config/qtchooser/qt6.conf /usr/share/qtchooser/qt6.conf
  • Set Qt6 as default option
bash 复制代码
sudo mkdir -p /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser
sudo ln -sf /usr/share/qtchooser/qt6.conf /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser/default.conf

当前用户解决方案 2. Select Qt6 for current user only

  • Generate qt6.conf based on path to qmake6
bash 复制代码
qtchooser -install qt6 $(which qmake6)
  • Select Qt6 as default (place in ~/.bashrc for persistence):

    export QT_SELECT=qt6

参考资料

相关推荐
Ha_To15 分钟前
2025.12.18 NAT地址转换、PAT
linux·服务器·网络
爱吃番茄鼠骗21 分钟前
Linux操作系统———I/O多路复用
linux
vortex536 分钟前
Linux 命令行入门:命令的构成与选项用法
linux·运维·服务器
m0_474606781 小时前
Linux安装docker教程
linux·运维·docker
落霞的思绪1 小时前
Mybatis读取PostGIS生成矢量瓦片实现大数据量图层的“快显”
linux·运维·mybatis·gis
像风一样的男人@1 小时前
linux --防火墙
linux·运维·服务器
网硕互联的小客服2 小时前
Centos系统如何更改root账户用户名?需要注意什么?
linux·运维·服务器·数据库·安全
lisanmengmeng2 小时前
zentao的prod环境升级(一)
linux·运维·数据库·docker·容器·禅道
wunianor2 小时前
[高并发服务器]DEBUG日志
linux·运维·服务器·c++
nbsaas-boot2 小时前
SQL Server 存储过程设计规范(事务与异常处理)
linux·数据库·设计规范