Building from Sources | Qt Installer Framework Documentation 4.11.0

- Qt Installer Framework Documentation
- Building from Sources
- Qt Installer Framework 4.11.0

Installation ◦ End User Workflows

# Building from Sources

The following steps describe how to build the Qt Installer Framework yourself.

For more information about how to install a pre-built version, see Installation.

## Supported Compilers

You can compile the Qt Installer Framework with Microsoft Visual Studio 2022 and newer, GCC 10 and newer, and Clang 15.0.0 and newer. Currently, the tested combination for Windows is Qt 6.9.1 with MSVC 2022 (Windows 11).

## Configuring Qt

If you use a statically built Qt to build the Qt Installer Framework you do not have to deliver Qt libraries, which enables you to distribute installers as one file. For more information about statically linking against OpenSSL libraries, see SSL Import and Export Restrictions.

The supported Qt version is 6.9.1.

Get Qt sources:

     \l{https://wiki.qt.io/Building_Qt_6_from_Git}{Get Qt sources from git}.
     Call init-repository with --module-subset=qt5compat, qtbase, qtdeclarative, qttools, qttranslations

### Configuring Qt for Windows

Use the following configuration options for Windows:

     configure -prefix %CD%\qtbase -release -static -static-runtime -accessibility -no-icu -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests

### Configuring Qt for Linux

Use the following configuration options for Linux:

     configure -prefix $PWD/qtbase -release -static -accessibility -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre -no-glib -no-cups -no-sql-sqlite -no-feature-gssapi -no-qml-debug -no-opengl -no-egl -no-sm -no-icu -nomake examples -nomake tests -no-libudev -bundled-xcb-xinput -qt-harfbuzz -qt-doubleconversion

### Configuring Qt for macOS

Use the following configuration options for macOS:

     configure -prefix $PWD/qtbase -release -static -accessibility -qt-zlib -qt-libpng -no-cups -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -no-freetype

Build Qt:

     cmake --build . --parallel
     cmake --install .

## Third Party Dependencies

The Qt Installer Framework sources contain a redistribution of parts of the `libarchive` compression and archive library, which requires you to link against the following libraries; `liblzma`, `zlib`, `libbzip2`, and on macOS, `libiconv`.

This enables support of creating and extracting 7zip, zip, and tar archive files, with `gzip`, bzip2, and `xz` as available compression methods.

You can use the `IFW_ZLIB_LIBRARY`, `IFW_BZIP2_LIBRARY`, `IFW_LZMA_LIBRARY`, and `IFW_ICONV_LIBRARY` variables to specify the exact library files.

If you add the `-qt-zlib` configuration to the Qt version used to build the Qt Installer Framework, and `IFW_ZLIB_LIBRARY` variable is empty, `libarchive` will try to use the `zlib` library compiled into the QtCore module, which removes the need for an external library.

### Installing Dependencies for Windows

You can download the source archives for the dependencies from:

- https://tukaani.org/xz/
- https://zlib.net/
- https://www.sourceware.org/bzip2/

When building the third party libraries with MSVC, make sure to use the same version that you used to build Qt, and that the compiler option used to select the run-time library matches the configuration options for Qt (debug/release, static/dynamic runtime).

### Installing Dependencies for Linux

The required third party compression libraries are likely available from your distribution's package manager repositories.

For example, on Ubuntu 18.04 you can invoke the following to install the development packages containing headers for the libraries:

     sudo apt install zlib1g-dev liblzma-dev libbz2-dev

### Installing Dependencies for macOS

The easiest way to install the missing libraries is with a third party package manager solution, like Homebrew or MacPorts. On macOS 10.15 you should only need to additionally install the `liblzma` library.

On Homebrew this would be:

     brew install xz

### Troubleshooting

For `libarchive` related compilation errors, you may need to edit the definitions in a configuration header file respective to your platform. You can find this file in the `src/libs/3rdparty/libarchive/config/` directory of the Installer Framework sources.

## Setting up Qt Installer Framework

1. Clone the Qt Installer Framework source code from http://code.qt.io/cgit/installer-framework/installer-framework.git/ to get the sources for the tools.
2. Build the tools by running the "qmake" from the static Qt, followed by "make" or "nmake".

Note: To contribute patches to Qt Installer Framework, follow the standard Qt processes and guidelines. For more information, see Contribute to Qt.

See also Installation.

Installation ◦ End User Workflows