10

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?

Petr
  • 409

1 Answers1

10

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.

kenn
  • 5,162
  • yes I forgot about Qt installer, that works – Petr Feb 21 '14 at 21:06
  • Wish there were a little more information here about which components to install. – Translunar Jan 21 '16 at 18:18
  • How do I use this without .pro file?? I try this and get .... Usage: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake [mode] [options] [files]

    QMake has two modes, one mode for generating project files based on some heuristics, and the other for generating makefiles. Normally you shouldn't need to specify a mode, as makefile generation is the default mode for qmake, but you may use this to test qmake on an existing project.........

    – Patrick Mutwiri Apr 11 '18 at 12:52
  • @PatrickMutwiri To create .pro file you need to run qmake -project then qmake -makefile. Check out qmake --help In your case it's /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -project – kenn Apr 11 '18 at 13:11