%general-entities; ]> $LastChangedBy$ $Date$ Qt-&qt-version; Qt Introduction to <application>Qt</application> 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): Download MD5 Sum: &qt-md5sum; Download size: &qt-size; Estimated disk space required: &qt-buildsize; Estimated build time: &qt-time; <application>Qt</application> dependencies Required Recommended and Optional , , , , SQLite, Firebird and unixODBC Installation of <application>Qt</application> 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 <filename class='directory'>/usr</filename> 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 -e 's:cp -f:install: -e 's:$(QTDIR)/include:&/qt:' \ -e 's:$(QTDIR)/lib:&/qt:' \ 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-libmng \ -no-exceptions -thread -plugin-imgfmt-png \ -system-libjpeg -system-libpng && find -type f -name Makefile | xargs sed -i "s@-Wl,-rpath,/usr/lib@@g" && make && Now, as the root user: make install && ln -sf libqt-mt.so /usr/lib/libqt.so && rm /usr/bin/qmake && install -m755 -oroot -groot qmake/qmake /usr/bin && cp -r doc/man /usr/share && cp -r examples /usr/share/doc/qt && And finally back as regular user: exit Method 2 - Installing in <filename class='directory'>/opt</filename> 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-&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 Now, as the root user: make install && ln -sfn qt-&qt-version; /opt/qt && ln -s libqt-mt.so /opt/qt/lib/libqt.so && rm /opt/qt-&qt-version;/bin/qmake && install -m755 -oroot -groot qmake/qmake /opt/qt-&qt-version;/bin && cp -r doc/man /opt/qt/doc && cp -r examples /opt/qt/doc And finally back as regular user: exit If you pass the switch to the configure command, you must also pass so make can find the appropriate header files. Command explanations sed -i -e 's:cp -f:install: -e 's:$(QTDIR)/include:&/qt:' -e 's:$(QTDIR)/lib:&/qt:' mkspecs/linux*/qmake.conf: install is safer than cp when libraries are in use. Also, directories need to be adjusted to match the BLFS Method 1 installation directories. 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 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: This switch enables libpng to be linked to at runtime. -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 paths. Otherwise, uic always tries to run with Qt libraries in /usr/lib. ln -s libqt-mt.so /usr/lib/libqt.so: This command allows configure scripts to find a working Qt installation. rm .../qmake; install -m755 -oroot -groot qmake/qmake .../bin: The qmake program is installed incorrectly by make install. These two commands install the program correctly. 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 <application>Qt</application> 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: export QTDIR=/usr 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.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 /etc/ld.so.conf /etc/man.conf /etc/profile ~/.bash_profile 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 The Qt/X11 library contains APIs necessary to build and use programs based on the Qt GUI toolkit. Installed Programs Installed Libraries Installed Directories assistant, designer, linguist, lrelease, lupdate, moc, qm2ts, qmake, qtconfig, and uic libqt-mt.so, libqt.so libqui.so, libdesignercore.a, libeditor.a, and libqassistantclient.a /opt/qt-&qt-version; 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. 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 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 qm2ts is a tool for converting Qt message file formats. qm2ts qmake qmake uses information stored in project files to determine what should go in the makefiles it generates. qmake qtconfig is used to customize the appearance of Qt applications. qtconfig uic is a Qt user interface compiler. uic