- 1 Use Qt5 for Development
- 1.1 Build Qt5 from Sources
- 1.2 Use Qt5 Distribution Packages
Use Qt5 for Development
Qt is the base of mostly all KDE software. Thus, when developing any KDE application or framework, you require Qt. For this, either you can use development packages by your distribution or compile Qt yourself. Note that using Qt development packages often is the more convenient way. If the Qt version provided by your distribution is recent enough (in terms of version, features and bug fixes) and you do not have any specific reason to do otherwise, use Qt distribution packages.
Build Qt5 from Sources
In the following, we explain how to build Qt5 from sources. Choose one of the following sections to get your Qt setup.
- Full Debug Build: If you build Qt with the intention to actually develop Qt patches then you should go for a full debug build.
- Pro: full control and debugging capabilities
- Contra: takes long to compile on the first time, might be an additional source of errors for beginners
- Release Build: If you merely need Qt to develop KDE applications then you should go for the release with debug symbol version.
- Pro: This build is the most ideal build when developing applications and tuning performance. It has the speed of a release build but with debug symbols which give you more information in for example kcachegrind with data collected through valgrind.
- Contra: The Qt libraries will be quite a lot bigger due to the debug symbols.
Note that it is not officially supported to build just individual frameworks (though it works). This might be caused by limited time or disk space and hence you just want to build some of Qt5. In this case, you could restrict yourself to separate checkouts of qtbase.git, qtsvg.git, qtx11extras.git, qtscript.git and qttools.git. This is enough to build frameworks/* (but not enough for e.g. plasma-framework).
Both instructions contain the following steps, only the configure-step differs.
You need the following tools:
Initial Clone of the Qt5 Repository
To clone the required sources to build all of Qt5 execute:
git clone git://code.qt.io/qt/qt5.git --branch 5.5
Configure and Build: Variant 1 (Full Debug Build)
cd qt5 ./init-repository ./configure -prefix $PWD/qtbase -opensource -confirm-license -nomake tests -nomake examples \ -dbus -no-separate-debug-info -xcb -system-xcb -qpa xcb -no-gtkstyle -developer-build make
Configure and Build: Variant 2 (Release Build)
cd qt5 ./init-repository ./configure -prefix $PWD/qtbase -opensource -confirm-license -nomake tests -nomake examples -dbus \ -no-separate-debug-info -xcb -system-xcb -qpa xcb -no-gtkstyle -release -force-debug-info -reduce-relocations \ -optimized-qmake make
Later Update of the Qt5 Repository
To update qt5 later:
git pull git submodule sync git submodule update --recursive
If you saw changes (i.e. qt5.git got updated since last time),
./configure [...same as above...] make echo $? # you should make extra sure that 'make' didn't abort with an error, especially when using -j
Distribution Specific Notes
Use Qt5 Distribution Packages
- Pro: faster to get started, one source of errors less
- Contra: usually doesn't have debug symbols. Great for developing applications and measuring performance. Not so great for tuning performance (you'd need debug symbols for that).
Note that the Qt version currently must be >= 5.5
openSUSE 13.2 (outdated)
WARN: It is probably better not to use 13.2 anymore; go for 42.1 instead.
- 13.2: add the repository http://download.opensuse.org/repositories/KDE:/Qt54/openSUSE_13.2/
- install packages:
$ sudo zypper install libqt5-qttools libgypsy0 libqt5-creator libqt5-linguist libqt5-qtbase-common-devel libqt5-qtbase-debugsource libqt5-qtbase-devel libqt5-qtbase-doc libqt5-qtbase-examples libqt5-qtdeclarative-debugsource libqt5-qtdeclarative-devel libqt5-qtdeclarative-examples libqt5-qtdeclarative-tools libqt5-qtdoc libqt5-qtgraphicaleffects libqt5-qtimageformats libqt5-qtimageformats-debugsource libqt5-qtimageformats-devel libqt5-qtmultimedia-devel libqt5-qtmultimedia-examples libqt5-qtquick1-devel libqt5-qtquickcontrols libqt5-qtscript-devel libqt5-qtscript-examples libqt5-qtsvg-devel libqt5-qttools-debugsource libqt5-qttools-devel libqt5-qtx11extras-devel libqt5-qtxmlpatterns-devel libqt5-qtxmlpatterns-examples libQt5CLucene5 libQt5Concurrent-devel libQt5Concurrent5 libQt5Core-devel libQt5Core5 libQt5DBus-devel libQt5DBus5 libQt5Declarative5 libQt5Designer5 libQt5DesignerComponents5 libQt5Gui-devel libQt5Gui5 libQt5Help5 libQt5Multimedia5 libQt5Network-devel libQt5Network5 libQt5OpenGL-devel libQt5OpenGL5 libQt5Positioning5 libQt5PrintSupport-devel libQt5PrintSupport5 libQt5Script5 libQt5Sensors5 libQt5Sql-devel libQt5Sql5 libQt5Sql5-mysql libQt5Sql5-postgresql libQt5Sql5-sqlite libQt5Sql5-unixODBC libQt5Svg5 libQt5Test-devel libQt5Test5 libQt5WebKit5 libQt5WebKitWidgets5 libQt5Widgets-devel libQt5Widgets5 libQt5X11Extras5 libQt5Xml-devel libQt5Xml5 libQt5XmlPatterns5 libQtQuick5 libQt5WebKitWidgets-devel libqt5-qtbase-private-headers-devel
(these might be too much packages but with those the KF5 build worked)
- For now, Qt >= 5.5 can only be found in experimental repository. If it's not already the case, add it to your sources list and update :
$ sudo sh -c "echo 'deb http://ftp.debian.org/debian experimental main' >> /etc/apt/sources.list" $ sudo apt-get update * If you have key warnings, you can install them with $ gpg --keyserver pgpkeys.mit.edu --recv-keys 8B48AD6246925553 $ gpg -a --export 8B48AD6246925553 | sudo apt-key add - $ gpg --keyserver pgpkeys.mit.edu --recv-keys 7638D0442B90D010 $ gpg -a --export 7638D0442B90D010 | sudo apt-key add - $ sudo apt-get install -t experimental qtbase5-dev qtbase5-private-dev libqt5x11extras5-dev qtscript5-dev qttools5-dev libqt5svg5-dev libqt5xmlpatterns5-dev qttools5-dev-tools qtdeclarative5-dev