Qt Packaging Recommendations

Distributions might want to package multiple different Qt versions. By taking the example of a Linux distribution, we recommend the following approach:

  • Configure Qt to install executables to /usr/qt6/bin.
  • Create symlinks with version suffixes in /usr/bin to user-facing applications that reside in /usr/qt6/bin. For example, create the symlink /usr/bin/designer6 that points to /usr/qt6/bin/designer.

User-facing applications are Qt tools that are supposed to be started by the user. This includes qmake, Qt Designer, Qt Linguist, and others. Other tools, such as moc, rcc, and uic are usually not manually invoked by the user but from the build system of user projects.

In Qt's build system, tools that we consider as user-facing are marked as such, and that information can be extracted and used as follows.

Configure Qt with the CMake arguments:

-DCMAKE_INSTALL_PREFIX=/usr
-DINSTALL_BINDIR=/usr/qt6/bin
-DINSTALL_PUBLICBINDIR=/usr/bin

This will create a file called user_facing_tool_links.txt in Qt's build directory. It contains on each line the path of a user-facing tool in INSTALL_BINDIR and, separated by one space, the path to the versioned link in INSTALL_PUBLICDIR.

This file can be used to create all versioned symlinks:

xargs ln -s < user_facing_tool_links.txt

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.