Qt Installation
← Practised Platform | ● | Qt Documentation →
Prerequisites
Unix software development with Qt requires the installation of the following tools:
- cmake
- gnu/c++ compiler
- svn
- qt/qmake
- [OpenGL]
Installation of GCC and SVN
The GCC (Gnu Compiler Collection including the gcc and g++ compilers) is usually already installed with Ubuntu (and Mac). To test it, open the unix terminal and type “gcc —version”. On my Mac this gives the following output:
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To test svn, we tell it to give us some help about the available subversion commands:
svn help
A list of most common svn subcommands:
add checkout (co) commit (ci) copy (cp) delete (del, remove, rm) diff (di) log revert status (stat, st) update (up)
Also see the SVN HowTo to learn more about Subversion/SVN.
Installation of CMake
Open the Ubuntu software manager, search for the package “cmake” and select it and all its dependencies for installation. Then click the install button.
Installation of OpenGL
The installation of OpenGL (and GLUT) is vendor specific: On MacOS X it is already installed with the XCode development package, on Linux it comes with the “mesa-dev”, “X11-dev” and “free-glut3-dev” development packages whereas on Windows it is usually installed with the MSVC IDE.
Installation of Qt4
On MacOS X and Windows, it is recommended to build and install Qt from source!
On Linux, it is mostly sufficient to install a recent Qt binary package using the Ubuntu software manager, for example. The list of available Ubuntu packages is available online.
On the command line installation is even simpler:
sudo apt-get install qt4-dev-tools
Installation of Qt4 from Source
If you install Qt from source, for example on a Mac or when there is no binary package available, we grab the source tar ball from:
ftp://ftp.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz
Create a working directory for your software projects (e.g. ~/qt-projects) and put the Qt source tar ball (.tar.gz. .tgz) there.
Then use the Terminal (unix shell) to navigate (change directory) to the working directory:
cd ~/qt-projects
Extract the Qt source tarball:
tar zxvf qt-everywhere-opensource-src-4.7.4.tar.gz
Navigate into the extracted source
cd qt-everywhere-opensource-src-4.7.4
Then type on the unix console:
./configure -opensource && make
After the build process has finished (go get yourself a cup of coffee) you need to install the compiled binaries and libraries on the Unix system via the following unix command:
sudo make install
You will be asked to enter your root password for installation of Qt. The binaries will usually be installed in /usr/local/Trolltech/… or /usr/local/Qt… depending on your system configuration.
Now we are ready to get our hands on the first Qt example.
← Practised Platform | ● | Qt Documentation →