Qt-4.8.6
      
      
        
          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.7
          platform.
        
        
          Package Information
        
        
        
          Qt Dependencies
        
        
          Required
        
        
          Xorg
          Libraries
        
        
          Recommended
        
        
          alsa-lib-1.0.28, MesaLib-10.4.5, Certificate Authority
          Certificates, D-Bus-1.8.16, GLib-2.42.1,
          ICU-54.1 (unicode support), libjpeg-turbo-1.4.0, libmng-2.0.2, libpng-1.6.16,
          LibTIFF-4.0.3, OpenSSL-1.0.2,
          and SQLite-3.8.8.2
        
        
          Optional
        
        
          Cups-2.0.2, GTK+-2.24.26 (GTK+ 2 theme support),
          gst-plugins-base-0.10.36 (For
          QtWebKit HTML5 Video), MariaDB-10.0.16 or MySQL, PostgreSQL-9.4.1, PulseAudio-5.0, and unixODBC-2.3.2
        
        
          User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/qt4
        
       
      
        
          Qt Installation Alternatives
        
        
          The installation of Qt presents
          several challenges and choices. Complicating the Qt installation is
          the fact that there are two versions, Qt4 and Qt5,
          that have executable programs with identical names. If both
          packages are installed on one system, the only methods to manage
          which set of programs is used is to either control the users'
          PATH or to rename files either directly
          or via symbolic links. Both packages cannot be installed in the
          same directory.
        
        
          If you are only going to install one of the Qt versions, the choice
          of installation methods is easier. You can either install the
          components in the several directories of the /usr hierarchy or install the entire package in a
          separate directory of your choice. We refer to these options below
          as "Method 1: Installing in /usr" and "Method 2: Installing in
          /opt".
        
        
          If both versions of Qt are to be installed, one or both versions
          need to be installed in a separate directory. For the purposes here
          we use the /opt directory. The
          selection of which version is being used by individual users on a
          system is controlled by the PATH
          variable. Other systems can be designed, but the BLFS editors find
          the PATH method easiest.
        
        
          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. The disadvantage for BLFS
          users is that this Qt instance cannot be upgraded while it is in
          use. For instance, it cannot be upgraded from a running KDE
          environment. It also precludes having multiple versions of Qt on
          your system and does not allow reverting to an existing, known
          working instance of Qt.
        
        
          The advantage of installing Qt in
          a custom directory such as /opt/qt-4.8.6 or /opt/qt-5.4.0 or is that it keeps 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 or merely changing the PATH variable. It
          also allows a developer to maintain multiple versions of
          Qt4 or Qt5 for testing.
        
       
      
        
          Installation of Qt
        
        
          ![[Caution]](../images/caution.png) 
          
            Caution
          
          
            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.
          
         
        
          ![[Warning]](../images/warning.png) 
          
            Warning
          
          
            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.
          
         
        
          ![[Note]](../images/note.png) 
          
            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.
          
         
        
          Fix DoS vulnerability in the GIF image handler:
        
        
sed -i -e '631a if (image->isNull()) { state = Error; return -1; }' \
    src/gui/image/qgifhandler.cpp
        
          Method 1: Installing in /usr
        
        
          Install Qt4 into the /usr hierarchy by running the following commands:
        
        
export QT4LINK=/usr
sed -i -e "/#if/d" -e "/#error/d" -e "/#endif/d" \
     config.tests/unix/libmng/libmng.cpp &&
sed -i '/CONFIG -/ a\isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..' \
     src/3rdparty/webkit/Source/WebKit2/DerivedSources.pro &&
./configure -prefix         /usr                 \
            -bindir         /usr/bin             \
            -plugindir      /usr/lib/qt4/plugins \
            -importdir      /usr/lib/qt4/imports \
            -headerdir      /usr/include/qt4     \
            -datadir        /usr/share/qt4       \
            -sysconfdir     /etc/xdg             \
            -docdir         /usr/share/doc/qt4   \
            -demosdir       /usr/share/doc/qt4/demos    \
            -examplesdir    /usr/share/doc/qt4/examples \
            -translationdir /usr/share/qt4/translations \
            -confirm-license   \
            -opensource        \
            -release           \
            -dbus-linked       \
            -openssl-linked    \
            -system-sqlite     \
            -no-phonon         \
            -no-phonon-backend \
            -no-nis            \
            -no-openvg         \
            -nomake demos      \
            -nomake examples   \
            -optimized-qmake   &&
make
        
          This package does not come with a test suite.
        
        
          Remove references to the build directory from the .pc files by running the following command:
        
        
find . -name "*.pc" -exec perl -pi -e "s, -L$PWD/?\S+,,g" {} \;
        
          Now as the root user:
        
        
make install &&
rm -rf /usr/tests
        
          Remove references to the build directory from installed files by
          running the following command as the root user:
        
        
for file in 3Support CLucene Core DBus Declarative DesignerComponents \
            Designer Gui Help Multimedia Network OpenGL Script \
            ScriptTools Sql Svg Test UiTools WebKit XmlPatterns Xml phonon; do
     [ -e /usr/lib/libQt${file}.prl ] &&
     sed -r '/^QMAKE_PRL_BUILD_DIR/d;s/(QMAKE_PRL_LIBS =).*/\1/' \
         -i /usr/lib/libQt${file}.prl
done
unset file
        
          Method 2: Installing in /opt/qt-4.8.6
        
        
          This section provides for installing Qt4 almost all of the files in
          the /opt directory.
        
        
export QT4DIR=/opt/qt-4.8.6 &&
export QT4LINK=/opt/qt4 &&
sed -i -e "/#if/d" -e "/#error/d" -e "/#endif/d" \
     config.tests/unix/libmng/libmng.cpp &&
sed -i '/CONFIG -/ a\isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..' \
     src/3rdparty/webkit/Source/WebKit2/DerivedSources.pro &&
./configure -prefix     $QT4DIR  \
            -sysconfdir /etc/xdg \
            -confirm-license     \
            -opensource          \
            -release             \
            -dbus-linked         \
            -openssl-linked      \
            -system-sqlite       \
            -plugin-sql-sqlite   \
            -no-phonon           \
            -no-phonon-backend   \
            -no-nis              \
            -no-openvg           \
            -nomake demos        \
            -nomake examples     \
            -optimized-qmake     &&
make
        
          Now, as the root user:
        
        
make install
ln -svfn $QT4DIR /opt/qt4
        
          Remove references to the build directory from installed files by
          running the following command as the root user:
        
        
for file in `basename -a -s .prl $QT4DIR/lib/lib*.prl`; do
       sed -r -e '/^QMAKE_PRL_BUILD_DIR/d'    \
              -e 's/(QMAKE_PRL_LIBS =).*/\1/' \
              -i $QT4DIR/lib/${file}.prl
   perl -pi -e "s, -L$PWD/?\S+,,g" $QT4DIR/lib/pkgconfig/${file##lib}.pc
done
unset file
        
          Continuing for Both Methods
        
        
          For all methods, install images and create the menu entries for
          installed applications. Be sure that the QT4LINK variable is defined in root's environment
          and as the root user:
        
        
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=$QT4LINK/bin/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=$QT4LINK/bin/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=$QT4LINK/bin/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=$QT4LINK/bin/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=$QT4LINK/bin/qtconfig
Icon=qt4logo.png
Terminal=false
Encoding=UTF-8
Type=Application
Categories=Qt;Settings;
EOF
       
      
        
          Command Explanations
        
        
          sed -i ...: First
          command fixes detection of libmng
          2.0 and second one prevents configure script from writing to the
          root directory if building as privileged user.
        
        
          -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 phonon-4.8.3 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.
        
        
          -no-dbus: 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
export QT4DIR
# End /etc/profile.d/qt4.sh
EOF
          
            If you installed Qt 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:
          
          
cat >> /etc/ld.so.conf << EOF
# Begin Qt addition
   
/opt/qt4/lib
   
# End Qt addition
EOF
ldconfig
          
            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
   
pathappend /opt/qt4/bin           PATH
pathappend /opt/qt4/lib/pkgconfig PKG_CONFIG_PATH
   
export QT4DIR
   
# End /etc/profile.d/qt4.sh
EOF
         
        
          
            Choosing Qt Program Versions
          
          
            If you install both Qt4 and Qt5, you can use some simple scripts
            to select the currently active set of Qt programs. As the
            root user, create the following
            scripts:
          
          
cat > /usr/bin/setqt4 << 'EOF'
if [ "x$QT5DIR" != "x/usr" ]; then pathremove  $QT5DIR/bin; fi
if [ "x$QT4DIR" != "x/usr" ]; then pathprepend $QT4DIR/bin; fi
echo $PATH
EOF
          
cat > /usr/bin/setqt5 << 'EOF'
if [ "x$QT4DIR" != "x/usr" ]; then pathremove  $QT4DIR/bin; fi
if [ "x$QT5DIR" != "x/usr" ]; then pathprepend $QT5DIR/bin; fi
echo $PATH
EOF
          
            You should now be able to use the appropriate Qt version by
            running source
            setqt4 or source
            setqt5 as desired. (Setting the PATH wont work in
            a subshell.) Another technique that can be used is to create
            appropriate alias additions to your ~/.bashrc like alias setqt4='source setqt4'.
          
         
       
      
        
          Contents
        
        
          
            
              Installed Programs:
              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
            
            
              Installed Libraries:
              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
            
            
              Installed Directories:
              /usr/include/qt4, /usr/lib/qt4,
              /usr/share/doc/qt4, and /usr/share/qt4 OR /opt/qt4 and
              /opt/qt-4.8.6
            
           
         
        
          
            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
                   | 
                    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.
                   | 
              
                | 
                    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 2015-02-22 21:16:54 -0800