qtchooser -install qt6 $(which qmake6)
qtchooser -install qt6 $(which qmake6)
https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of
In Ubuntu 22.04 after installing Qt6 using
sudo apt install qt6-base-dev
calling qmake results in an error message:
qmake: could not find a Qt installation of ''
or
qmake: could not exec '/usr/lib/qt5/bin/qmake': No such file or directory
It is however possible to call/run qmake6. How to make qmake work and point it to qmake6?
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
qtchooser -install qt6 $(which qmake6)
Move qt6.conf to system-wide dir
sudo mv ~/.config/qtchooser/qt6.conf /usr/share/qtchooser/qt6.conf
Set Qt6 as default option
sudo mkdir -p /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser
sudo ln -n /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
qtchooser -install qt6 $(which qmake6)
Select Qt6 as default (place in ~/.bashrc for persistence):
export QT_SELECT=qt6
========== End

浙公网安备 33010602011771号