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

参考资料

相关推荐
远游客07132 小时前
centos stream 8下载安装遇到的坑
linux·服务器·centos
马甲是掉不了一点的<.<2 小时前
本地电脑使用命令行上传文件至远程服务器
linux·scp·cmd·远程文件上传
jingyu飞鸟2 小时前
centos-stream9系统安装docker
linux·docker·centos
超爱吃士力架3 小时前
邀请逻辑
java·linux·后端
White_Mountain4 小时前
在Ubuntu中配置mysql,并允许外部访问数据库
数据库·mysql·ubuntu
cominglately5 小时前
centos单机部署seata
linux·运维·centos
魏 无羡5 小时前
linux CentOS系统上卸载docker
linux·kubernetes·centos
coder_pig5 小时前
📝小记:Ubuntu 部署 Jenkins 打包 Flutter APK
flutter·ubuntu·jenkins
CircleMouse5 小时前
Centos7, 使用yum工具,出现 Could not resolve host: mirrorlist.centos.org
linux·运维·服务器·centos
木子Linux6 小时前
【Linux打怪升级记 | 问题01】安装Linux系统忘记设置时区怎么办?3个方法教你回到东八区
linux·运维·服务器·centos·云计算