qmake: could not find a Qt installation of ''
I have a software in ubuntu that requires me to run qmake to generate the Makefile.
However, running qmake gives back this error,
qmake: could not find a Qt installation of ''
I have installed what I thought to be the required packages using,
sudo apt-get install qt4-qmake
sudo apt-get install qt5-qmake
But the error didn't go away.
Any help on this would be gladly appreciated!
Solution 1:
sudo apt-get install qt5-default
works for me.
$ aptitude show qt5-default
tells that
This package sets Qt 5 to be the default Qt version to be used when using development binaries like qmake. It provides a default configuration for qtchooser, but does not prevent alternative Qt installations from being used.
Solution 2:
You could check path to qmake using which qmake
.
Consider install qt4-default
or qt5-default
depends what version of qt you want use.
You could also use qtchooser - a wrapper used to select between Qt development binary versions.
Solution 3:
For others in my situation, the solution was:
qmake -qt=qt5
This was on Ubuntu 14.04 after install qt5-qmake. qmake was a symlink to qtchooser which takes the -qt argument.
Solution 4:
As Debian Qt's maintainer please allow me to suggest you to not use qtx-default. Please read qtchooser's man page, the solution is described there. If you are interested in packaging an app you can also take a look at this blog post I made explaining how to do it
# method 1
QT_SELECT=qt5 qmake
# method 2:
export QT_SELECT=qt5
qmake
... more qt commands here
# method 3:
make -qt5
To use Qt 4, just replace the qt5
with qt4
Update 20210202: starting from Debian 11 (bullseye) the packages qtx-default do not longer exist. Same goes for Ubuntu, but I don't know in which specific version. If you know of a package that still has the dependency (mostly non-Debian official packages) please file a bug. Same goes for Wiki pages, etc.
Solution 5:
I had this problem building jasmine-headless-webkit Ruby gem. Despite having qt4 installed, qmake
(a symlink to qtchooser
) insisted it didn't know about a QT installation. OTOH, it was able to list qt4 when asked directly.
This made everything better:
export QT_SELECT=qt4
qtchooser then knew to use qmake-qt4, and so on.