%general-entities; ]> $LastChangedBy$ $Date$ Qt-&qt4-version; Qt Introduction to Qt4 Qt4 is a cross-platform application framework that is widely used for developing application software with a graphical user interface (GUI) (in which cases Qt4 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 KDE4. &lfs79_checked; Package Information Download (HTTP): Download (FTP): Download MD5 sum: &qt4-md5sum; Download size: &qt4-size; Estimated disk space required: &qt4-buildsize; Estimated build time: &qt4-time; Qt Dependencies Required Recommended , , , , , (For QtWebKit HTML5 Video), (unicode support), , , , , , , and Optional , (GTK+ 2 theme support), or MySQL, , , and User Notes: Setting the installation prefix Installing in /opt/qt4 The BLFS editors recommend installing Qt4 in a directory other than /usr, ie /opt/qt4. To do this, set the following environment variable: export QT4PREFIX=/opt/qt4 Sometimes, the installation paths are hardcoded into installed files. This is the reason why /opt/qt4 is used as installation prefix instead of /opt/qt-&qt4-version;. To create a versioned Qt4 directory, you may rename the directory and create a symlink: mkdir -pv /opt/qt-&qt4-version; ln -sfnv qt-&qt4-version; /opt/qt4 Later on, you may want to install other versions of Qt4. To do that, just remove the symlink and use /opt/qt4 as the prefix again. Which version of Qt4 you use depends only on where the symlink points. Installation of Qt4 If Qt4 is being reinstalled into the same directory as an existing instance, run the commands done by root, such as make install, from a console or non-Qt4 based window manager. It overwrites Qt4 libraries that should not be in use during the install process. If you did not install some of the recommended dependencies, examine ./configure --help output to check how to disable them or use internal versions bundled in the source tarball. 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 BLFS editors do not recommend installing Qt4 into the /usr hierarchy because it becomes difficult to find components and to update to a new version. If you do want to install Qt4 in /usr, the directories need to be specified explicitly. In this case, set QT4PREFIX=/usr and add the following to the configure arguments below: -bindir /usr/bin/qt4 \ -plugindir /usr/lib/qt4/plugins \ -importdir /usr/lib/qt4/imports \ -headerdir /usr/include/qt4 \ -datadir /usr/share/qt4 \ -docdir /usr/share/doc/qt4 \ -translationdir /usr/share/qt4/translations \ -demosdir /usr/share/doc/qt4/demos \ -examplesdir /usr/share/doc/qt4/examples \ Install Qt4 by running the following commands: ./configure -prefix $QT4PREFIX \ -sysconfdir /etc/xdg \ -confirm-license \ -opensource \ -release \ -dbus-linked \ -openssl-linked \ -system-sqlite \ -no-phonon \ -no-phonon-backend \ -no-webkit \ -no-openvg \ -nomake demos \ -nomake examples \ -optimized-qmake && make This package does not come with a test suite. Now as the root user: make install && rm -rf $QT4PREFIX/tests Remove references to the build directory from the installed .pc files by running the following command as the root user: find $QT4PREFIX/lib/pkgconfig -name "*.pc" -exec perl -pi -e "s, -L$PWD/?\S+,,g" {} \; Remove references to the build directory in the installed library dependency (prl) files by running the following command as the root user: for file in $QT4PREFIX/lib/libQt*.prl; do sed -r -e '/^QMAKE_PRL_BUILD_DIR/d' \ -e 's/(QMAKE_PRL_LIBS =).*/\1/' \ -i $file done Installing Auxillary Files The following instructions assume that your working directory is the top of the Qt4 source tree: popd Install images and create the menu entries for installed applications. The QT4BINDIR variable is used here to point to the directory for the executable programs. If you have changed the bindir above, QT4BINDIR will need to be adjusted below. Be sure that the QT4BINDIR variable is defined in root's environment and as the root user: QT4BINDIR=$QT4PREFIX/bin install -v -Dm644 src/gui/dialogs/images/qtlogo-64.png \ /usr/share/pixmaps/qt4logo.png && install -v -Dm644 tools/assistant/tools/assistant/images/assistant-128.png \ /usr/share/pixmaps/assistant-qt4.png && install -v -Dm644 tools/designer/src/designer/images/designer.png \ /usr/share/pixmaps/designer-qt4.png && install -v -Dm644 tools/linguist/linguist/images/icons/linguist-128-32.png \ /usr/share/pixmaps/linguist-qt4.png && install -v -Dm644 tools/qdbus/qdbusviewer/images/qdbusviewer-128.png \ /usr/share/pixmaps/qdbusviewer-qt4.png && install -dm755 /usr/share/applications && cat > /usr/share/applications/assistant-qt4.desktop << EOF [Desktop Entry] Name=Qt4 Assistant Comment=Shows Qt4 documentation and examples Exec=$QT4BINDIR/assistant Icon=assistant-qt4.png Terminal=false Encoding=UTF-8 Type=Application Categories=Qt;Development;Documentation; EOF cat > /usr/share/applications/designer-qt4.desktop << EOF [Desktop Entry] Name=Qt4 Designer Comment=Design GUIs for Qt4 applications Exec=$QT4BINDIR/designer Icon=designer-qt4.png MimeType=application/x-designer; Terminal=false Encoding=UTF-8 Type=Application Categories=Qt;Development; EOF cat > /usr/share/applications/linguist-qt4.desktop << EOF [Desktop Entry] Name=Qt4 Linguist Comment=Add translations to Qt4 applications Exec=$QT4BINDIR/linguist Icon=linguist-qt4.png MimeType=text/vnd.trolltech.linguist;application/x-linguist; Terminal=false Encoding=UTF-8 Type=Application Categories=Qt;Development; EOF cat > /usr/share/applications/qdbusviewer-qt4.desktop << EOF [Desktop Entry] Name=Qt4 QDbusViewer GenericName=D-Bus Debugger Comment=Debug D-Bus applications Exec=$QT4BINDIR/qdbusviewer Icon=qdbusviewer-qt4.png Terminal=false Encoding=UTF-8 Type=Application Categories=Qt;Development;Debugger; EOF cat > /usr/share/applications/qtconfig-qt4.desktop << EOF [Desktop Entry] Name=Qt4 Config Comment=Configure Qt4 behavior, styles, fonts Exec=$QT4BINDIR/qtconfig Icon=qt4logo.png Terminal=false Encoding=UTF-8 Type=Application Categories=Qt;Settings; EOF Some packages such as look for certain executables with a -qt4 suffix. Run the following command as the root user to create the necessary symlinks: for file in moc uic rcc qmake lconvert lrelease lupdate; do ln -sfrvn $QT4BINDIR/$file /usr/bin/$file-qt4 done Command Explanations -confirm-license: Accept license without prompting user during configuration. -opensource: Install the opensource version of Qt. -release: This switch disables building with debugging symbols. -nomake examples -nomake demos: These switches disable building programs that are only of interest to a developer using Qt. -system-sqlite: This switch enables use the system version of SQLite. -no-nis: This switch disables support for Network Information Service (NIS) which has been deprecated in recent versions of Glibc. -no-phonon -no-phonon-backend: These switches disable building of the bundled Phonon library. Better version is provided by package. -dbus-linked -openssl-linked: These switches enable explicit linking of the D-Bus and OpenSSL libraries into Qt libraries instead of dlopen()-ing them. -no-openvg: This switch disables OpenVG support in Qt. -optimized-qmake: This switch enables building of the optimized qmake program. : Use this switch if you don't have D-Bus installed. Configuring Qt Configuration Information If you installed Qt in /usr, create an environment variable needed by certain packages. As the root user: cat > /etc/profile.d/qt4.sh << "EOF" # Begin /etc/profile.d/qt4.sh QT4DIR=/usr QTDIR=$QT4DIR export QT4DIR QTDIR pathappend $$QT4DIR/qt/bin # End /etc/profile.d/qt4.sh EOF If you installed Qt4 in a location other than /usr, you 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: If you installed Qt4 in /usr with the commands specified above, the PATH entries in the scripts below need to be adjusted accordingly. cat >> /etc/ld.so.conf << EOF # Begin Qt addition /opt/qt4/lib # End Qt addition EOF ldconfig /etc/ld.so.conf As the root user, create the /etc/profile.d/qt4.sh file: cat > /etc/profile.d/qt4.sh << "EOF" # Begin /etc/profile.d/qt4.sh QT4DIR=/opt/qt4 QTDIR=$QT4DIR pathappend $QT4DIR/bin PATH pathappend $QT4DIR/lib/pkgconfig PKG_CONFIG_PATH export QT4DIR QTDIR # End /etc/profile.d/qt4.sh EOF Contents Installed Programs Installed Libraries Installed Directories assistant, designer, lconvert, linguist, lrelease, lupdate, moc, pixeltool, qcollectiongenerator, qdbuscpp2xml, qdbus, qdbusviewer, qdbusxml2cpp, qdoc3, qhelpconverter, qhelpgenerator, qmake, qmlplugindump, qmlviewer, qt3to4, qtconfig, qttracereplay, rcc, uic3, uic, xmlpatterns, and xmlpatternsvalidator libQtUiTools.a, libQt3Support.so, libQtCLucene.so, libQtCore.so, libQtDBus.so, libQtDeclarative.so, libQtDesignerComponents.so, libQtDesigner.so, libQtGui.so, libQtHelp.so, libQtMultimedia.so, libQtNetwork.so, libQtOpenGL.so, libQtScript.so, libQtScriptTools.so, libQtSql.so, libQtSvg.so, libQtTest.so, libQtWebKit.so, libQtXmlPatterns.so, and libQtXml.so, and several plugins under /opt/qt4/imports and /opt/qt4/plugins /usr/include/qt4, /usr/lib/qt4, /usr/share/doc/qt4, and /usr/share/qt4 OR /opt/qt4 and /opt/qt-&qt4-version; Short Descriptions assistant is a tool for presenting on-line documentation. assistant 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. designer lconvert is part of Qt4's Linguist tool chain. It can be used as a standalone tool to convert and filter translation data files. lconvert linguist provides support for translating applications into local languages. linguist lrelease is a simple command line tool. It reads a Qt project file and produces message files used by the application. lrelease 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. lupdate moc generates Qt meta object support code. moc pixeltool is a desktop magnifier and as you move your mouse around the screen it will show the magnified contents in its window. pixeltool qcollectiongenerator is a tool used to create a Qt Help Collection. qcollectiongenerator qdbuscpp2xml takes a C++ source file and generates a D-Bus XML definition of the interface. qdbuscpp2xml qdbus lists available services, object paths, methods, signals, and properties of objects on a bus. qdbus qdbusviewer is a graphical D-Bus browser. qdbusviewer qdbusxml2cpp is a tool that can be used to parse interface descriptions and produce static code representing those interfaces, qdbusxml2cpp qdoc3 is a tool used by Qt Developers to generate documentation for software projects. qdoc3 qhelpconverter is a tool used to convert files to Qt help format. qhelpconverter qhelpgenerator is a tool used to generate a Qt compressed help file. qhelpgenerator qmake uses information stored in project files to determine what should go in the makefiles it generates. qmake qmlplugindump is a tool to create a qmltypes file. qmlplugindump qmlviewer is a tool for loading QML documents that makes it easy to quickly develop and debug QML applications. qmlviewer qt3to4 qt3to4 is a tool to help update Qt3 code to Qt4. qt3to4 qtconfig is used to customize the appearance of Qt applications. qtconfig qttracereplay is a tool to replay all drawing operations recording with -graphicssystem trace into a trace buffer. qttracereplay rcc is a resource compiler used in conjunction with designer. rcc uic is a Qt user interface compiler. uic uic3 is a tool to generate Qt4 code out of user interface files generated by the Qt3 version of designer. uic3 xmlpatterns provides support for XPath, XQuery, XSLT, and XML Schema validation. xmlpatterns xmlpatternsvalidator is a tool used to validate XML documents. xmlpatternsvalidator