Qt-&qt-version;
Introduction to Qt
The Qt package contains a
C++ GUI library. This is useful
for creating graphical applications or executing graphical applications that
are dynamically linked to the Qt library. One of the
major users of Qt is KDE.
Package information
Download (HTTP):
Download (FTP):
MD5 Sum: &qt-md5sum;
Download size: &qt-size;
Estimated Disk space required: &qt-buildsize;
Estimated build time: &qt-time;
Qt dependencies
Required
Recommended
and .
Optional
, , ,
, Firebird,
and unixODBC.
Installation of Qt
There are several ways to install a complicated package such as Qt.
The files are not completely position independent. Installation procedures execute the
program pkg-config to determine the location of package executables, libraries,
headers, and other files. For Qt, pkg-config will
look for the file lib/pkgconfig/qt-mt.pc which must be modified if relocating the
package. This file is set up correctly by the build process.
The default installation places the files in /usr/local/qt/.
Many commercial distributions place the files in the system's
/usr hierarchy. The package can also be installed
in an arbitrary directory.
This section will demonstrate two different methods.
The build time for Qt is quite long. If you want to
save some time and don't want the tutorials and examples, change the first make line to:
make sub-tools
Method 1 - Installing in the /usr hierarchy
The advantage of this method is that no updates to the /etc/ld.so.conf
or /etc/man.conf files are required. The package files
are distributed within several subdirectories of the /usr
hierarchy. This is the method that most commercial distributions use.
sed -i "s:cp -f:install:" mkspecs/linux-g++/qmake.conf &&
bash
export PATH=$PWD/bin:$PATH &&
export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH &&
./configure -prefix /usr -docdir /usr/share/doc/qt \
-headerdir /usr/include/qt -plugindir /usr/lib/qt/plugins \
-datadir /usr/share/qt -translationdir /usr/share/qt/translations \
-sysconfdir /etc/qt -qt-gif -system-zlib \
-no-exceptions -thread -plugin-imgfmt-png -system-libpng &&
find -type f -name Makefile | xargs sed -i "s@-Wl,-rpath,/usr/lib@@g" &&
make &&
make install &&
ln -sf libqt-mt.so /usr/lib/libqt.so &&
cp -r doc/man /usr/share &&
cp -r examples /usr/share/doc/qt &&
exit
Method 2 - Installing in /opt
This is the method recommended by the Qt developers. It
has the advantage of keeping all the package files consolidated in a dedicated directory
hierarchy. By using this method, an update can be made without overwriting a previous
installation and users can easily back up to a previous version by changing one symbolic
link.
The Qt developers use a default location of
/usr/local/qt/, however this procedure puts the files
in /opt/qt-&qt-version;/ and then creates a
symbolic link to /opt/qt/.
bash
export QTDIR=$PWD &&
export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH &&
export PATH=$PWD/bin:$PATH &&
./configure -prefix /opt/qt-&qt-version; -qt-gif -system-libpng \
-system-libmng -system-zlib -system-libjpeg -no-exceptions \
-thread -plugin-imgfmt-png &&
make &&
make install &&
ln -sfn qt-&qt-version; /opt/qt &&
ln -s libqt-mt.so /opt/qt/lib/libqt.so &&
cp -r doc/man /opt/qt/doc &&
cp -r examples /opt/qt/doc
exit
Configuration
For Method 2 only, update the /etc/ld.so.conf and
/etc/man.conf files.
cat >> /etc/ld.so.conf << "EOF"
# Begin qt addition to /etc/ld.so.conf
/opt/qt/lib
# End qt addition
EOF
ldconfig
cat >> /etc/man.conf << "EOF"
# Begin qt addition to man.conf
MANPATH /opt/qt/doc/man
# End qt addition to man.conf
EOF
Also, QTDIR needs to be set when compiling packages that depend on Qt.
Add the following so that it is available when compiling packages.
export QTDIR=/opt/qt
Command explanations
sed -i "s:cp -f:install:" mkspecs/linux-g++/qmake.conf:
install is safer than cp when
libraries are in use.
bash: This command enters a sub-shell to isolate
environment changes.
export QTDIR=$PWD: This command
defines where the root of the Qt directory is located.
export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH: This command
allows the not yet installed qt libraries to be used by the not yet installed qt programs.
export PATH=$PWD/bin:$PATH: This command
allows the build process to find supporting executables.
-qt-gif: This switch adds support for gif
files to the libraries.
-system-zlib -system-libpng: This switch
forces the library to use the shared libraries that are on your system
instead of recreating its own set of support libraries for these
functions.
-no-exceptions: This switch disables
the exceptions coding generated by the C++ compiler.
-thread: This switch adds
support for multi-threading.
find -type f -name Makefile | xargs sed -i "s@-Wl,-rpath,/usr/lib@@g":
This command removes hardcoded run-time path, else
uic tries to run with system installed Qt
libraries.
ln -s libqt-mt.so /usr/lib/libqt.so: This
command allows configure scripts
to find a working Qt installation.
cp -r doc/man /usr/share (or /opt/qt/doc): This command
installs the man pages which are missed by make install.
cp -r examples /usr/share/doc/qt (or /opt/qt/doc): This command
installs the examples which are missed by make install.
exit: This command returns to the parent shell
and eliminates environment variables set earlier.
Configuring Qt
Configuration Information
&library-config;
Contents
The Qt/X11
library contains API's necessary to use
programs based on Qt GUI toolkit.
The Qt package contains
assistant,
designer,
linguist,
lrelease,
lupdate,
moc,
qm2ts,
qmake,
qtconfig,
uic, and the
libqt-mt and
libqui libraries.