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

参考资料

相关推荐
勤奋的凯尔森同学21 分钟前
webmin配置终端显示样式,模仿UbuntuDesktop终端
linux·运维·服务器·ubuntu·webmin
月光水岸New1 小时前
Ubuntu 中建的mysql数据库使用Navicat for MySQL连接不上
数据库·mysql·ubuntu
莫忘初心丶1 小时前
在 Ubuntu 22 上使用 Gunicorn 启动 Flask 应用程序
python·ubuntu·flask·gunicorn
打不了嗝 ᥬ᭄5 小时前
Linux的权限
linux
落幕5 小时前
C语言-进程
linux·运维·服务器
深度Linux5 小时前
C++程序员内功修炼——Linux C/C++编程技术汇总
linux·项目实战·c/c++
风静如云6 小时前
OpenBMC:BmcWeb定义service
linux
leoufung7 小时前
VIM FZF 安裝和使用
linux·编辑器·vim
bugtraq20218 小时前
XiaoMi Mi5(gemini) 刷入Ubuntu Touch 16.04——安卓手机刷入Linux
linux·运维·ubuntu
CodeWithMe8 小时前
[ Vim ] 常用命令 and 配置
linux·编辑器·vim