Qt-3.3.8b

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

Qt Dependencies

Required

X Window System

Recommended

Note: if for whatever reason you do not have the recommended libraries installed on your system, you must remove the corresponding -system-<library> and -plugin-imgfmt-<library> parameters from the configure commands shown in the instructions below.

Optional

NAS-1.9, CUPS-1.2.12, MySQL-5.0.41, PostgreSQL-8.2.4, unixODBC-2.2.12, SQLite and Firebird

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/qt

Installation of Qt

This package (unfortunately) expects the X Window system to be installed in the /usr/X11R6 directory. If you're using a recent version of Xorg and it is installed in any other location, ensure you have followed the instructions in the Creating an X11R6 Compatibility Symlink section.

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.

[Warning]

Warning

Building Qt in a chroot environment may fail.

[Note]

Note

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 command 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_db.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.

[Note]

Note

If Qt is being reinstalled, run the following commands from a console or non-Qt based window manager. It overwrites Qt libraries that should not be in use during the install process.

sed -i '/QMAKE_RPATH/d' mkspecs/linux*/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 \
            -system-libpng \
            -system-libjpeg \
            -system-libmng \
            -plugin-imgfmt-png \
            -plugin-imgfmt-jpeg \
            -plugin-imgfmt-mng \
            -no-exceptions \
            -thread \
            -tablet &&

make &&
exit

This package does not come with a test suite.

Now, as the root user:

make install &&
ln -v -sf libqt-mt.so /usr/lib/libqt.so &&
ln -v -snf ../../bin /usr/share/qt/bin &&
ln -v -snf ../../include/qt /usr/share/qt/include &&
ln -v -snf ../../lib /usr/share/qt/lib &&
cp -v -r doc/man /usr/share &&
cp -v -r examples /usr/share/doc/qt

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 revert 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-3.3.8b/ 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-3.3.8b \
            -sysconfdir /etc/qt \
            -qt-gif \
            -system-zlib \
            -system-libpng \
            -system-libjpeg \
            -system-libmng \
            -plugin-imgfmt-png \
            -plugin-imgfmt-jpeg \
            -plugin-imgfmt-mng \
            -no-exceptions \
            -thread \
            -tablet &&

make &&
exit

This package does not come with a test suite.

Now, as the root user:

make install &&
ln -v -sfn qt-3.3.8b /opt/qt &&
ln -v -s libqt-mt.so /opt/qt/lib/libqt.so &&
cp -v -r doc/man examples /opt/qt/doc

Command Explanations

sed -i '/QMAKE_RPATH/d' mkspecs/linux*/qmake.conf: In Method 1, Qt is being installed into the standard system directories. The runtime library search path does not need to be set in this case.

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 -system-libjpeg -system-mng: These switches force the build instructions to use the shared libraries that are on your system instead of creating a custom set of support libraries for these functions.

-plugin-imgfmt-png -plugin-imgfmt-jpeg -plugin-imgfmt-mng: These switches enable run-time linking of the referenced libraries.

If you pass the -plugin-sql-<driver> or -qt-sql-<driver> switch to the configure command, you must also pass -I</path/to/sql/headers> so make can find the appropriate header files. For instance, building in MySQL support (as opposed to building the plugin) will need to use -I/usr/include/mysql -qt-sql-mysql.

[Note]

Note

To check if mysql is autotetected properly, examine the output of ./configure -I/usr/include/mysql -help. Other database support will require similar configure parameters.

-no-exceptions: This switch disables the exceptions coding generated by the C++ compiler.

-thread: This switch adds support for multi-threading.

ln -v -sf libqt-mt.so /usr/lib/libqt.so: This command allows configure scripts to find a working Qt installation.

ln -v -snf ../../bin /usr/share/qt/bin: This command and the following two allow the /usr style installation to mimic the /opt style installation by making all binaries, headers and libraries available from a single directory, /usr/share/qt.

cp -v -r doc/man examples /usr/share (or /opt/qt/doc): This command installs the man pages and examples which are missed by make install.

exit: This command returns to the parent shell and eliminates the environment variables set earlier.

Configuring Qt

Configuration Information

The QTDIR environment variable needs to be set when building packages that depend on Qt. Add the following to the .bash_profile initialization script for each user that builds packages using the Qt libraries. Alternatively, the variable can be set in the system wide /etc/profile file.

For Method 1 (This is optional, only set this if an application is unable to find the installed libraries or headers):

export QTDIR=/usr/share/qt

or for Method 2:

export QTDIR=/opt/qt

If you installed Qt using Method 2, you also need to update the following configuration files so that Qt is correctly found by other packages and system processes.

Update the /etc/ld.so.conf and /etc/man_db.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_db.conf << "EOF"
# Begin qt addition to man_db.conf

MANDATORY_MANPATH /opt/qt/doc/man

# End qt addition to man_db.conf
EOF

Update the PKG_CONFIG_PATH environment variable in your ~/.bash_profile or /etc/profile with the following:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt/lib/pkgconfig

If you want the Qt executables in your shell search path, update the PATH environment variable in your ~/.bash_profile or /etc/profile to include /opt/qt/bin.

As with most libraries, there is no explicit configuration to do. After updating /etc/ld.so.conf as explained above, run /sbin/ldconfig so that ldd can find the shared libraries.

Contents

Installed Programs: assistant, designer, linguist, lrelease, lupdate, moc, qm2ts, qmake, qtconfig, and uic
Installed Libraries: libqt-mt.so, libqt.so libqui.so, libdesignercore.a, libeditor.a, and libqassistantclient.a
Installed Directories: /opt/qt-3.3.8b or /usr/lib/qt, /usr/share/qt, /usr/share/doc/qt, /usr/include/qt, and /etc/qt

Short Descriptions

assistant

is a tool for presenting on-line documentation.

designer

is a full-fledged GUI builder. It includes powerful features such as preview mode, automatic widget layout, support for custom widgets, and an advanced property editor.

linguist

provides support for translating applications into local languages.

lrelease

is a simple command line tool. It reads a Qt project file and produces message files used by the application.

lupdate

reads a Qt project file, finds the translatable strings in the specified source, header and Qt Designer interface files, and produces or updates the translation files listed in the project file.

moc

generates Qt meta object support code.

qm2ts

is a tool for converting Qt message file formats.

qmake

qmake uses information stored in project files to determine what should go in the makefiles it generates.

qtconfig

is used to customize the appearance of Qt applications.

uic

is a Qt user interface compiler.

Last updated on 2008-05-06 16:29:57 -0500