How to Install Qt 5.0 on Ubuntu 12.10


Nathan Osman's Gravatar

Nathan Osman
published Dec. 19, 2012, 8:19 p.m.


Well folks, today Digia has made a very special announcement - Qt 5.0 has been released! This is very exciting considering that it has been 7 years since Qt 4.0 was released. So what's new in this release? This page goes into detail on the new features so I won't waste time pasting them here. Here are just a couple things to whet your appetite:

  • A brand new hardware accelerated graphics engine.
  • Support for a number of C++11 features.
  • Native support for parsing and generating JSON.

Now, the next question becomes... how do we install this in Ubuntu since the latest version in the Quantal repositories is 4.8.3? I'm glad you asked.

Sadly, I have been unable to find a PPA with the final released version of Qt 5.0. So we will have to build it ourselves.

Warning: you need a lot of disk space. Just the source code alone is about 650 MB before building.

Begin by opening a terminal and running these commands:

sudo apt-get install build-essential perl python "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev flex bison gperf libicu-dev libxslt-dev ruby libcups2-dev libgstreamer-plugins-base0.10-dev libssl-dev libpulse-dev libasound2-dev libgtk2.0-dev
wget http://releases.qt-project.org/qt5/5.0.0/single/qt-everywhere-opensource-src-5.0.0.tar.gz
tar -xf qt-everywhere-opensource-src-5.0.0.tar.gz
cd qt-everywhere-opensource-src-5.0.0

Just a quick note to explain what's happening here: basically we're installing the packages we need for building Qt and downloading / extracting the source archive. Feel free to prefix the commands above with cd /tmp if you don't want a bunch of temporary files cluttering up your hard drive when you're done.

Now for the fun part - actually compiling the library. This isn't really as bad as it sounds. The first step is to use the ./configure command to indicate exactly what we want built and how (this will take about one or two minutes):

./configure -opensource -confirm-license -release -nomake tests -nomake examples -nomake demos

There are quite a few options. Here is the complete list as obtained from ./configure --help. In this case, we are skipping debug information (since it uses up even more disk space) and we're not building the examples or demos.

The actual build takes place with this command:

make -j3

Now go make yourself a cup of coffee. This will take some time to complete (a couple of hours on a fast machine). Once the process completes successfully, you can install all of the newly compiled files by running:

sudo make install

That's it! That wasn't so bad, was it?