4

I have installed Qt 5.6 from the official website via a *.run file. The installation directory is in my home folder. When I run

qmake --version

I get the following message:

qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory

I think the problem is that the operating system does not look for the qmake in the correct directory (I have Qt installed in my home folder).

How can I tell the operating system to search for Qt in my home folder?

Unique
  • 175
  • I have two folders in "/usr/lib/x86_64-linux-gnu/" named qt4 and qt5. The default searching directory is in qt4, while I have qt5 installed. It does not seem a good choice to create a link in qt4 while I have qt5. There should be a way to tell the operating system to search in the desired folder. – Unique Jul 21 '17 at 14:15
  • 2
    Well OK hold on a second though. Why did you install via the .run file? That is not the recommended way to install software on Linux. Why didn't you use apt-get? – You'reAGitForNotUsingGit Jul 21 '17 at 14:17
  • 2
    apt-get would have updated alternatives, right now it does not know that qt5 is installed – ravery Jul 21 '17 at 14:24
  • Well, I was searching for a specific version of Qt and I found it in the official website. There was not a .deb file and I did not know how to select the version of Qt using apt-get. – Unique Jul 21 '17 at 14:25

2 Answers2

10

The solution lies in using update-alternatives(8). For more information on the reasoning behind it, refer to What exactly does `update-alternatives` do?

sudo update-alternatives --install /usr/bin/qmake qmake /usr/lib/x86_64-linux-gnu/qt5/bin/qmake 100

followed by:

sudo update-alternatives --config qmake

to make sure the qt5 version is being used. This will update /usr/bin/qmake to point to the qt5 version.

A side note: You may need to check /usr/bin/ to see if there is already a symlink. If it is not managed by update-alternatives then you may need to manually remove or rename it for this to work.

Hope that helps!

0

This worked for me:

sudo apt-get install qt4-qmake libqt4-dev

Followed by:

sudo update-alternatives --install /usr/bin/qmake qmake /usr/lib/x86_64-linux-gnu/qt4/bin/qmake 100