Qt-4.8.1

Introduction to Qt

Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface (GUI) (in which cases Qt is classified as a widget toolkit), and also used for developing non-GUI programs such as command-line tools and consoles for servers. One of the major users of Qt is KDE.

This package is known to build and work properly using an LFS-7.1 platform.

Package Information

Additional Downloads

Qt Dependencies

Required

X Window System

Recommended

Optional

gst-plugins-base-0.10.36, PulseAudio-2.0, gtk+-2.24.10, OpenSSL-1.0.1a, Cups-1.5.0, MySQL-5.5.17, PostgreSQL-9.0.6, unixODBC-2.3.1 and SQLite-3.7.11

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

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 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 installing in /usr 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.

[Caution]

Caution

If Qt is being reinstalled and the /usr directory is used as the prefix, 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.

[Note]

Note

The build time and space required for the full Qt 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 Qt 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 Qt developers use a default location of /usr/local/qt/, however the procedure below puts the files in /opt/qt-4.8.1/ and then creates a symbolic link to /opt/qt/.

Configure Qt by running the following commands:

patch -Np1 -i ../qt-everywhere-opensource-src-4.8.1-gcc_fix-1.patch &&
patch -Np1 -i ../qt-everywhere-opensource-src-4.8.1-glib_fix-1.patch &&
sed -i '/-Werror/d' src/3rdparty/webkit/Source/WebKit.pri &&
./configure -prefix /opt/qt-4.8.1  \
            -release               \
            -nomake examples       \
            -nomake demos          \
            -system-sqlite         \
            -no-nis                \
            -opensource            \
            -confirm-license &&
make
[Note]

Phonon

If KDE is intended to be installed, add -no-phonon to the ./configure command above. While installing KDE, a separate version of the Phonon libraries will be installed which better matches the needs of the KDE desktop.

This package does not come with a test suite.

Now, as the root user:

make install

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

ln -svfn qt-4.8.1 /opt/qt

Command Explanations

patch -Np1 -i qt-everywhere-...: The two patches fix compiling with GCC 4.7 and GLib 2.32.

sed -i '/-Werror/d'...: This sed prevents some compiler warnings being treated as errors when compiling with GCC 4.7. You can omit it if you are compiling with older GCC versions.

-release: This switch disables building with debugging symbols.

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

-system-sqlite: Use the system version of SQLite.

-no-nis: Disable support for Network Information Service (NIS).

-opensource: Install the opensource version of Qt.

-confirm-license: Accept license without prompting user during configuration.

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

[Note]

Note

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

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.

Configuring Qt

Configuration Information

If you installed Qt in a location other than /usr, you also need to update the following configuration files so that Qt is correctly found by other packages and system processes.

As the root user, update the /etc/ld.so.conf file and the dynamic linker's run-time cache file:

cat >> /etc/ld.so.conf << "EOF" &&
# Begin Qt addition

/opt/qt/lib

# End Qt addition
EOF
ldconfig

As the root user, create the /etc/profile.d/qt.sh file:

cat > /etc/profile.d/qt.sh << "EOF"
# Begin /etc/profile.d/qt.sh

QTDIR=/opt/qt

pathappend /opt/qt/bin           PATH
pathappend /opt/qt/lib/pkgconfig PKG_CONFIG_PATH

export QTDIR

# End /etc/profile.d/qt.sh
EOF

Contents

Installed Programs: assistant, assistant_adp, designer, lconvert, linguist, lrelease, lupdate, moc, pixeltool, qcollectiongenerator, qdbus, qdbuscpp2xml, qdbusviewer, qdbusxml2cpp, qhelpconverter, qhelpgenerator,qmake, qt3to4, qtconfig, qtdemo, rcc, uic, uic3 and xmlpatterns
Installed Libraries: libphonon.so, libQt3Support.so, libQtAssistantClient.so, libQtCLucene.so, libQtCore.so, libQtDesigner.so, libQtDBus.so, libQtDesignerComponents.so, libQtGui.so, libQtHelp.so, libQtNetwork.so, libQtOpenGL.so, libQtScript.so, libQtScriptTools.so, libQtSql.so, libQtSvg.so, libQtTest.so, libQtUiTools.a, libQtWebKit.so, libQtXml.so, libQtXmlPatterns.so and numerous plugin modules installed in /opt/qt/plugins
Installed Directories: /opt/qt-4.8.1

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.

pixeltool

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

qmake

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

qt3to4

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

qtconfig

is used to customize the appearance of Qt applications.

qtdemo

is a portal into various demonstrations of Qt applications.

rcc

is a resource compiler used in conjunction with designer.

uic

is a Qt user interface compiler.

uic3

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

Last updated on 2012-04-17 17:53:55 +0000