John Bokma MexIT
freelance Perl programmer

Installing Qt 4.7 on Ubuntu 10.04

Tuesday, November 1, 2011 | 0 comments

Yesterday I tried to install Qt 4.7 via the Linux/X11 64-bit "Online Installer" on Ubuntu 10.04. At first the installation failed since I ran out of space on the partition that has /usr/local/. I had selected the custom installation and added Qt Designer, its documentation, and the Qt Examples.

I got some unclear error in the installer because running failed somehow. Running manually this script using sudo resulted in the following output in the terminal window, slightly reformatted for clarity:

Creating default target rx71-harmattan-1134 ...
This may take a while ...
Extracting QEMU runtime rx71-harmattan-1134
.....9....8....7....6....5...write error: No space left on device
'xtar -C /usr/local/QtSDK/Madde/runtimes/rx71-harmattan-1134.wip -l 
returned nonzero

To overcome the space issue I created the directory /home/QtSDK and added a symbolic link, as root, to this directory from /usr/local/QtSDK. I ran the installer again, and removed MeeGo, Symbian, and Harmattan related components in the component selection step since I am not going to do any Qt mobile development in the near future. Since I had plenty of space on the partition holding the home directory the installation didn't cause any problem. Moreover, since I had excluded Harmattan, the downloading and installation process itself was also much faster.

Today I verified the total size of the directory and it turned out that this custom installation would fit without any problems in the 3GB free space I had left on my /usr/local parition. So I deleted the installation directory and the .config/Nokia directory in my home directory and installed Qt 4.7.4 as outlined below.

Downloading the Qt 4.7 online installer

Yesterday, I downloaded the Linux/X11 "Online Installer" from Nokia's Download Qt, the cross-platform application framework web page. Since I use the 64-bit version of Ubuntu Lucid Lynx I selected the 64-bit version of the installer as well. The MD5 digest of the downloaded file on my computer is as follows:


Installing a custom version of Qt 4.7

In a terminal I used cd to visit the directory into which the Qt SDK online installer was downloaded, made the file executable and started the installation process as follows:

 chmod 700
sudo ./

A window was opened showing the message "Welcome to the Qt SDK Setup Wizard." and another message stating "Retrieving component information from remote repository...". The retrieving process took a few seconds and when done I clicked on the Next button.

The second step in the installation wizard allowed me to specify the installation folder. I entered /usr/local/QtSDK. I also selected the "Custom" installation option in this step. Then I clicked the Next button to move on to step 3.

Since I selected custom installation in the previous step I was now able to select the components of the Qt SDK I wanted to be installed on my computer. I made the following changes to the default:

When I had made my custom selection I clicked the Next button. In the next step I agreed with the license, clicked the Next button, and finally arrived at the "Ready to Install" step. With one click on the Install button I started the Qt SDK custom installation.

After about 15 minutes the installation wizard showed the final step; installation was done. I unticked both the "Launch Qt Creator" and "Open Qt SDK ReadMe" and clicked the Finish button.

The size of /usr/local/QtSDK as reported by du after installation:

du -hs /usr/local/QtSDK/
542M	/usr/local/QtSDK/

Updating the PATH environment variable

In order to be able to use the various Qt tools from a terminal I had to update the PATH environment variable which I did by adding entries to /etc/environment using sudo vi /etc/environment. After the changes the file looked as follows:


Note the two QtSDK paths I added and also note that a backslash means that the line continues on the next line, making it easy to extend the PATH by just adding a new line ending with a backslash.

Be very careful when modifying the environment file. A small mistake might result in no longer being able to login after a reboot. If that happens, you can boot from a live CD and fix the issue in the environment file.

After I had made the required changes I rebooted the computer. When I logged back in I noticed that the 3 entries the Qt SDK installer had added to the Programming entry of the Applications menu had disappeared.

A simple Qt test

In order to test the fresh Qt SDK installation I copied the "Hello Qt" example from page 3 of C++ GUI Programming with Qt 4 - Second Edition, given below, into Emacs and saved the file as hello.cpp.

#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
  QApplication app(argc, argv);
  QLabel *label = new QLabel("Hello Qt!");
  return app.exec();

Then I ran qmake -project to create the default project file, followed by qmake to create the Makefile, followed by just make to build the program. When I ran the result by entering ./hello a small window showed up with the text "Hello Qt!"; success.

Final thoughts

While the Qt SDK installer allows for customization of the installation I think it would be nice if the component selection step had some options like "minimal", "no mobile development", etc.

It is unclear to me why the Qt Creator (IDE) can't be unselected during custom component selection.

It's unclear why entries added to the Programming submenu in the Applications menu disappear after reboot. Moreover, although I did select Qt Designer it didn't show up in the Programming submenu to begin with.

C++ development and Qt Related

Also today

Please post a comment | read 0 comments | RSS feed