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-devqtchooser -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
If you run qtchooser -install as root (eg, use sudo), it will add the configuration to the qt-default directory instead of a user's home directory, removing the need to move the conf file. This also means, for the purposes of creating a Docker image (as I am), you only need to do step 2 in the Dockerfile (that is RUN the command and set the ENV variable) for it to be functional container-wide. 

 

========== End

 

 

 

 
posted @ 2024-07-18 13:18  lsgxeva  阅读(82)  评论(0编辑  收藏  举报