Introduction to Qt4

The Qt4 package contains several C++ libraries with both GUI and non-GUI components. One of the major users of Qt4 is KDE4.

Package Information

Qt Dependencies


X Window System



NAS-1.9, D-BUS-1.0.2, GLib-2.12.12, OpenSSL-0.9.8g, CUPS-1.2.12, MySQL-5.0.41, PostgreSQL-8.2.4, unixODBC-2.2.12, and SQLite

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

Installation of Qt4

There are several ways to install a complicated package such as Qt4. 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 Qt4, pkg-config will look for the appropriate lib/pkgconfig/Qt*.pc files which must be modified if relocating the package. These files are 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.

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.



If Qt4 is being reinstalled and the /usr directory is used as the prefix, run the following commands from a console or non-Qt4 based window manager. It overwrites Qt4 libraries that should not be in use during the install process.



The build time and space required for the full Qt4 is quite long. The instructions below do not build the tutorials and examples. Removing the -nomake lines will create a complete build.

The method recommended by the Qt4 developers does not use the /usr directory prefix. 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 Qt4 developers use a default location of /usr/local/qt/, however the procedure below puts the files in /opt/qt-4.3.4/ and then creates a symbolic link to /opt/qt/.

Install Qt4 by running the following commands:

./configure -prefix /opt/qt-4.3.4  \
            -release                 \
            -nomake examples         \
            -nomake demos            \
            -no-separate-debug-info &&

This package does not come with a test suite.

Now, as the root user:

make install

If you installed Qt4 in the /opt directory, again as the root user issue:

ln -v -sfn qt-4.3.4 /opt/qt

Command Explanations

-release, -no-separate-debug-info: These switches minimizes the time and space used to build Qt4 by not adding debug information to the libraries.

-nomake examples, -nomake demos: These switches disable building programs that are only of interest to a Qt4 developer.

There are several optional directories that can be specified in the ./configure line. These include -bindir, -libdir, -docdir, and -headerdir. For a complete list, run ./configure -help.

-plugin-sql-<driver> or -qt-sql-<driver>: These switches build SQL support into the Qt4 libraries.



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

Configuring Qt4

Configuration Information

If you installed Qt4 in a location other than /usr, you also need to update the following configuration files so that Qt4 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


# End qt addition
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

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


If you want the Qt4 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.


Installed Programs: assistant, designer, linguist, lrelease, lupdate, moc, pixeltool, qmake, qt3to4, qtconfig, qtdemo, rcc, uic, and uic3
Installed Libraries: libQt3Support.so, libQtAssistantClient.so, libQtCore.so, libQtDesigner.so, libQtDesignerComponents.so, libQtGui.so, libQtNetwork.so, libQtOpenGL.so, libQtScript.so, libQtSql.so, libQtSvg.so, libQtTest.so, and libQtXml.so
Installed Directories: /opt/qt-4.3.4

Short Descriptions


is a tool for presenting on-line documentation.


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.


provides support for translating applications into local languages.


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


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.


generates Qt meta object support code.


is a desktop magnifier and as you move your mouse around the screen it will show the magnified contents in its window.


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


qt3to4 is a tool to help update Qt3 code to Qt4.


is used to customize the appearance of Qt applications.


is a portal into various demonstrations of Qt applications.


is a resource compiler used in conjucntion with designer.


is a Qt user interface compiler.


is a tool to generate Qt4 code out of user interface files generated by the Qt3 version of designer.

Last updated on 2008-05-09 08:00:42 -0500