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

参考资料

相关推荐
Andy杨2 小时前
20250718-1-Kubernetes 应用程序生命周期管理-应用部署、升级、弹性_笔记
linux·docker·容器
写写闲篇儿5 小时前
Python+MongoDB高效开发组合
linux·python·mongodb
一个龙的传说7 小时前
linux 常用命令
linux·服务器·zookeeper
路人蛃8 小时前
通过国内扣子(Coze)搭建智能体并接入discord机器人
人工智能·python·ubuntu·ai·aigc·个人开发
Ching·9 小时前
esp32使用ESP-IDF在Linux下的升级步骤,和遇到的坑Traceback (most recent call last):,及解决
linux·python·esp32·esp_idf升级
子柒s9 小时前
Linux 基础
linux
MC皮蛋侠客9 小时前
Ubuntu安装Mongodb
linux·mongodb·ubuntu
2201_7534369510 小时前
ubuntu基础搭建
linux·运维·ubuntu
莫到空离11 小时前
LVS三种模式实战
linux·服务器·网络