[qt] 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!

This question is related to qt ubuntu qmake

The answer is


A symbolic link to the desired version, defined globally:

sudo ln -s /usr/bin/qmake-qt5 /usr/bin/qmake

... or per user:

sudo ln -s /usr/bin/qmake-qt5 /home/USERNAME/.local/bin/qmake

... to see if it works:

qmake --version

I have qt4 installed. I found that using the following path worked for me, despite 'which qmake' returning /usr/bin/qmake, which is just a link to qtchooser anyway.

The following path works for me, on a 64 bit system. Running from the full path of:

/usr/lib/x86_64-linux-gnu/qt4/bin/qmake

For my Qt 5.7, open QtCreator, go to Tools -> Options -> Build & Run -> Qt Versions gave me the location of qmake.


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.


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.


  • Install qt using:

    sudo apt install qt5-qmake
    
  • Open ~/.bashrc file:

    vim ~/.bashrc
    
  • Added the path below to the ~/.bashrc file:

    export PATH="/opt/Qt/5.15.1/gcc_64/bin/:$PATH"
    
  • Execute/load a ~/.bashrc file in your current shell

    source ~/.bashrc`
    
  • Try now qmake by using the version command below:

    qmake --version
    

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.


Search where is qmake-qt4:

which qmake-qt4

For example qmake-qt4 is in this path:

/usr/bin/qmake-qt4

Create symbolic link:

cd /usr/local/sbin/
ln -s /usr/bin/qmake-qt4 .
mv qmake-qt4 qmake

Regards


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.


if assistant is run from terminal directly, it will use the default path, usually is the /usr/bin/assistant. I had similar situation, to make it work, all I had to do is to find the actual installation of my qt installation bin path, like xxx/Qt5.13.2/5.13.2/gcc_64/bin/, type xxx/Qt5.13.2/5.13.2/gcc_64/bin/assisstant directly from terminal