Side-by-side installation of Qt5 and Qt4

Timo Jyrinki timo.jyrinki at gmail.com
Wed May 15 12:25:52 UTC 2013


Hi,

Yes, Qt4 and Qt5 are fully co-installable in Ubuntu 13.04 (and 12.04 LTS +
12.10 with the help of the PPA). You should install either qt4-default or
qt5-default package to select which tools are given you by default, ie.
when you type eg. qmake without any parameters. You can then switch between
the toolsets/libraries runtime with the QT_SELECT variable. This also
applies to packaging, so if you are doing a .deb package, you can either
add a build-dependency on qt5-default or qt4-default, or use export
QT_SELECT in debian/rules (and remember to have build dependency to
qtchooser in addition to other Qt dependencies). See 'man qtchooser' for
more information.

The only additional hindrance is, that upstream KDE hard-coded the Qt4
binary directory in PATH (see LP: #1176686 for more information), which
prepends even /usr/bin which has qtchooser et cetera. This temporary
measure to make sure they always get Qt4's qdbus will most certainly go
away later, but until then you need to check your PATH variable in your
development environment when using KDE.

-Timo



2013/5/14 The Spencers <spencers1993 at gmail.com>

> Hello,
>
> I'm working on an application written using KDE 4.10 and Qt4.8. I'm mostly
> using KDE for the just UI, but since I am using Ubuntu and targeting Ubuntu
> (not KDE or Kubuntu) I am considering switching to Qt5 and the Ubuntu SDK
> once it becomes more stable and usable on the desktop, not just touch
> devices.
>
> Because of that, I'd like to try experimenting with Qt5 and the Ubuntu
> SDK. However, is it possible to install Qt5 in addition to Qt4 and the KDE
> development stuff? I assume it would be fine for running a pre-built
> application, and all the normal KDE apps and stuff would be fine, but will
> the combination work correctly when I try to build my KDE app? I'm asking
> this because I tried installing Unity Next after reading about it on
> omgubuntu.co.uk, and was unable to compile my KDE app due to it finding
> Qt5 instead of Qt4.
>
> While researching this, I came across a note on the canonical-qt5-edgers
> PPA [1] that said:
>
> 1. Qt4 and Qt5 are co-installable with the migration to the new qtchooser
> tool. The previous Debian/Ubuntu approach relied on renaming binaries and
> using alternatives. When packaging against Qt5, set environment variable
> QT_SELECT=qt5 or include a package dependency to qt5-default in the
> packaging. See man qtchooser for more information.
>
> So if I set QT_SELECT to qt4 when I want to build my KDE app, and change
> it back to qt5 when tinkering with the Ubuntu SDK, will this be sufficent?
>
> [1] https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-proper
>
> Thank you,
> Michael Spencer
>
> --
> Ubuntu-devel-discuss mailing list
> Ubuntu-devel-discuss at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20130515/b65ac23a/attachment.html>


More information about the Ubuntu-devel-discuss mailing list