how to install both qt5-qmake and qt4-qmake

There is no qt5-qmake on default LTS 12.04 repository so I am using ppa from ubuntu-sdk-team ppa:ubuntu-sdk-team/ppa

However since this or previous month, it stopped working to me. Now when I try to install both qt5-qmake qt4-qmake I get in some unresolvable dependency conflicts.

Is there any way to simply install both?


I could not find a reliable way though some say that qtchooser works but it doesn't work. What I do as a workaround is to install qt4 at first then install qt5, to revert back to qt4 just remove qt5-default, it will use qt4. To switch back to qt5 just install qt5-default. It's a tiny deb package lower than 500kb.

EDIT: When you attepted to remove qt5-default it will automatically install qt4-default

EDIT2: What I did yesterday to use latest version of qmake, I downloaded 32 bit offline installer from http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x86-5.2.1.run then set executable flag and installed it to /home/$USER/Qt5.2.1, it doesn't install it into system path. To use qmake to create makefile you need to specify the path/home/$USER/Qt5.2.1/5.2.1/gcc/bin/qmake -Wall ../project.pro worked for me

EDIT3: I found an easier way to switch between qt4 and qt5 using environment variables

To switch to qt4

 export QTCHOOSER_RUNTOOL=qtconfig
 export QT_SELECT=4

EDIT4:

As I get experienced about programming I come across more simple solutions.

You don't need to switch between QT4 <-> QT5 at all.

Install QT4 and QT5 packages from Ubuntu repositories and then locate qmake

locate qmake 

I am running Ubuntu 14.04.3 32 bit so my qmake paths are:

/usr/lib/i386-linux-gnu/qt4/bin/qmake
/usr/lib/i386-linux-gnu/qt5/bin/qmake

All you can do to build your project is to run

for qt4:

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

or for qt5:

/usr/lib/i386-linux-gnu/qt5/bin/qmake

in your source directory where project*.pro file exist.

Then to compile it with make command.