Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qmake: could not find a Qt installation of ''

Tags:

ubuntu

qt

qmake

People also ask

How do you find qmake in Qt?

qmake.exe is in bin directory of your Qt installation folder (along with all the Qt dlls for deployment). Your compiler should be detected automatically (check the Tools > Options > Build & Run > Compilers tab). Next, check if your Qt installation is detected (Qt Versions tab).

Where is qmake in qt5?

The qt formula is keg-only, so you need to use full paths to access its stuff. Qmake is at /usr/local/opt/qt/bin .


sudo apt install qt5-default works for me.

$ apt 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.


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.


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.


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.


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.


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


  • 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