[ fromfile: setup-nix.xml id: setup-nix ]
Open source development tools (ssh
, bash
, gcc
) are available natively on most UNIX-derived platforms.[98]
This section is for readers who use a computer with a *nix system installed.
The first step to prepare your computer for this book is to make sure that the full installation of Qt is available to you.
To see which (if any) version of Qt has already been installed on your system, start with the commands:
which qmake qmake -v
The "full" Qt (including development tools) is not installed.
It is installed, but your PATH
does not include
/path/to/qt/bin
It is installed by your package manager as qmake-qt4
, to avoid conflict with same-named executables from Qt3.
If it reports Using Qt version 4.x.y
, use the which
command to check whether these other Qt tools are available: moc, uic, assistant, designer
, and qtcreator
.
If these tests indicate that you have an earlier version or no Qt installed, or that you are missing some components of Qt, then you need to build or install the latest release of Qt and select the Qt executables as defaults in your path.
You can download, unpack, and compile the latest open source tarball from qt.nokia.com.
If you have the Qt SDK, you can run the Updater and select
, to download it into your Qt SDK directory. Be sure to also select demos and examples.Installing dependencies | |
---|---|
In Debian, it is possible with a single command to automatically install all the tools and libraries you need to build another Debian package. You can take advantage of this, when you want to build any popular open source tool from source. For more information, see Appendix D. apt-get build-dep libqt4-dev |
Be sure to read the README
file before you attempt to install software from any open source tarball.
Example E.1 shows the options we used to configure Qt 4.7.
Example E.1. ../bin/qtconfigure
#!/bin/sh
# specify -phonon if you want to build the audiojukebox exercise or
any of the Phonon examples.
# replace username with your username, and Qt473 with your version of
Qt
./configure -phonon -debug-and-release -fast
After Qt is configured, type make
and then install it.
Tip | |
---|---|
If you have a four-core processor, try typing make -j 4 and the compiler will run four compile processes simultaneously, taking full advantage of your extra cores. |
Tip | |
---|---|
After installation, type the command [ezust@stan] /home/ezust> which qmake which qmake /usr/local/Trolltech/QtSDK/Desktop/Qt/473/gcc/bin/qmake [ezust@cerberus] /home/ezust> qmake -version QMake version 2.01a Using Qt version 4.7.3 in /usr/local/Trolltech/QtSDK/Desktop/Qt/473/gcc/lib |
After installing, check your environment variables and make sure that your PATH
contains proper references to the built installed Qt.
Tip | |
---|---|
The |
Example E.2 shows how you can set the values of environment variables with bash
, but the actual values depend on where the files are located on your system.
Example E.2. ../bin/qt.sh
# Using the Qt SDK 1.1 # None of the variables below are required by Qt # I just like having variables pointing to these locations for easy access: export QTSDK=/opt/QtSDK export QTCREATOR=$QTSDK/QtCreator export QTDIR=$QTSDK/Desktop/Qt/473/gcc export QTSRC=$QTSDK/QtSources/4.7.3 # make sure SDK's qmake and qtcreator are found first in the path: export PATH=$QTDIR/bin:$QTCREATOR/bin:$PATH # Location of your shared libraries: export CPPLIBS=~/cs331/projects/libs # Where to search for shared object libraries at runtime: export LD_LIBRARY_PATH=$CPPLIBS
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |