|
|
(121 intermediate revisions by 12 users not shown) |
Line 1: |
Line 1: |
| This page is the continuation with more advanced topics of the page [[Get_Involved/development]]. | | This page is the continuation with more advanced topics of the page [[Get_Involved/development]]. |
|
| |
|
| This paged is not meant for people that are starting to program for KDE.
| | kde-builder has replaced the previous KDE build framework named kdesrc-build. |
|
| |
|
| == Develop in a Linux container == | | == Develop in a Linux container == |
|
| |
|
| When you start programming for KDE, it is recommended that you [[Get_Involved/development|use kdesrc-build in your main operating system or in a virtual machine]] running on a rolling-release Linux distribution (Arch, openSUSE Tumbleweed, KDE neon) or running on e.g. the latest version of Fedora KDE Spin or Kubuntu. | | When you start programming for KDE, it is recommended that you [[Get_Involved/development|use kde-builder in your main operating system or in a virtual machine]] running on a [[Get_Involved/development#Operating_system|Linux operating system that is better supported by kde-builder]]. |
|
| |
|
| As an alternative, you can run kdesrc-build in a Linux container (docker, podman, toolbx, distrobox). | | As an alternative, you can run kde-builder in a Linux container (docker, podman, toolbx, distrobox). |
|
| |
|
| === Option 1. The KDE PIM Docker image === | | === Option 1. The KDE PIM Docker image === |
Line 15: |
Line 15: |
| === Option 2. distrobox === | | === Option 2. distrobox === |
|
| |
|
| Or, you can just create a long lived (pet not cattle) container using distrobox and podman (or docker). See https://www.youtube.com/watch?v=9JEALbcmcCg and https://github.com/89luca89/distrobox to learn more about distrobox and how to use it in general.
| | It is possible to start developing KDE software using container images that are able to see inside your home folder. This can be done using distrobox and podman. |
|
| |
|
| First, install distrobox and podman from your distribution repositories. Then run:
| | This solution is particularly useful for users on immutable distributions like Fedora Kinoite, openSUSE Kalpa or Valve's SteamOS 3 |
|
| |
|
| {{Input|
| | To learn how to build KDE software with distrobox, see: https://develop.kde.org/docs/getting-started/building/containers-distrobox/ |
| distrobox enter | |
| }}
| |
|
| |
|
| This should create a container based on your current system and enter it. It is preferable to use one of the Linux distributions that is better suited for kdesrc-build, as mentioned [https://community.kde.org/Get_Involved/development#Linux in this wiki page], so if your distribution does not provide very up-to-date packages, you can download and use a different container image for your distrobox from [https://hub.docker.com/search?type=image Dockerhub]. For example, with openSUSE Tumbleweed:
| | == Other operating systems == |
|
| |
|
| {{Input|
| | === Kubuntu >= 24.10 === |
| podman pull opensuse/tumbleweed
| |
| distrobox create --image opensuse/tumbleweed --name tumbleweed
| |
| distrobox enter tumbleweed
| |
| }}
| |
|
| |
|
| Then it's a matter of downloading and running kdesrc-build as detailed in [https://community.kde.org/Get_Involved/development#Set_up_kdesrc-build Set up kdesrc-build]:
| | The default configuration of kde-builder requires Qt version 6.7. Kubuntu 24.10 has Qt version 6.6. It is recommended that you use a [[Get_Involved/development#Operating_system|Linux OS that is better supported by kde-builder]]. |
|
| |
|
| {{Input|<nowiki>
| | If you are a more seasoned developer you might be able to use Kubuntu for kde-builder by [[Get_Involved/development/More#Qt_6_installed_using_the_Qt_online_installer|installing Qt6 using the Qt online installer]] or by [[Get_Involved/development/More#Build_Qt_using_kde-builder|building Qt6 using kde-builder]]. |
| mkdir -p ~/kde/src
| |
| cd ~/kde/src
| |
| git clone https://invent.kde.org/sdk/kdesrc-build.git
| |
| ./kdesrc-build --initial-setup | |
| source ~/.bashrc
| |
| </nowiki>}}
| |
|
| |
|
| From this point on, one important thing to bear in mind is that a distrobox container is transparent in its user space and containerized in its root space: when you are inside a distrobox container, you can see the content of system's home folder, but not your system's root folders, only the container's root folders. This means that you can install packages inside the container using root privileges and access those packages to compile your programs stored in your home, without ever installing those packages in your actual system!
| | === Alpine Linux === |
|
| |
|
| You can take advantage of this by installing, for instance, Qt development packages used for kdesrc-build from inside the container. This way, it is not necessary to compile Qt with kdesrc-build. This is particularly convenient if you want to compile KDE software with Qt6 quickly.
| | <pre> |
| | | apk add git perl doas-sudo-shim |
| Likewise, you should [https://community.kde.org/Get_Involved/development/Install_the_dependencies install the required dependencies] from inside the distrobox rather than from your system's repositories. Then you can start compiling as usual.
| | </pre> |
| | |
| After compiling your program with kdesrc-build from inside the distrobox, you can run it with <code>kdesrc-build run</code>, and despite it originating from inside a container and using the libraries from the container, it will run just fine as a GUI application on your system!
| |
| | |
| The only few gotchas to using this method are:
| |
| | |
| * You cannot use a [https://community.kde.org/Get_Involved/development#Plasma_Desktop full Plasma Desktop session] made from git.
| |
| * You will need qqc2-desktop-style and Breeze to show the correct theme for your applications.
| |
| * You will need the QtWayland library and its respective development package to run your applications natively on a Wayland session.
| |
| | |
| == Other operating systems ==
| |
|
| |
|
| === FreeBSD === | | === FreeBSD === |
Line 69: |
Line 47: |
| </pre> | | </pre> |
|
| |
|
| Then set up kdesrc-build using the same procedure as when installing kdesrc-build on a Linux operating system. FreeBSD is currently supported by kdesrc-build. See https://www.youtube.com/watch?v=v2wq0eTnUuc https://www.youtube.com/watch?v=MT-AN4J-hn8 | | Then set up kde-builder using the same procedure as when installing kde-builder on a Linux operating system. FreeBSD is currently supported by kde-builder. See https://www.youtube.com/watch?v=8MqBnb3Y9JU |
| | |
| === Microsoft Windows ===
| |
| | |
| You can build and develop KDE projects using the [[Get_Involved/development/Windows|Microsoft Windows]] operating system.
| |
| | |
| === Apple macOS ===
| |
| | |
| You can build and develop KDE projects using the [[Get_Involved/development/Mac|Apple macOS]] operating system.
| |
| | |
| == What to do if CMake configure fails because a build dependency is missing ==
| |
| | |
| If you run kdesrc-build in order to build a KDE git repository. And if building fails with a CMake error. Then, that is most often caused by the fact that you do not have installed some binary packages from your Linux OS.
| |
| | |
| See below for some ideas about how to find out what Linux packages you need to install.
| |
| | |
| === Debian/Kubuntu/KDE neon ===
| |
| | |
| E.g. I am on Kubuntu 22.10, <code>kdesrc-build frameworks</code> fails, module <code>kcoreaddons</code> has CMake (configure) error <code>Could NOT find Qt6LinguistTools (missing: Qt6LinguistTools_DIR)</code>.
| |
| | |
| Option 1:
| |
| | |
| Search on the internet for <code>ubuntu packages Qt6LinguistTools</code> it returns https://packages.ubuntu.com/kinetic/amd64/qt6-tools-dev Expand "amd64 [list of files]": <code>/usr/lib/x86_64-linux-gnu/cmake/Qt6LinguistTools/Qt6LinguistToolsConfig.cmake</code>
| |
| | |
| {{Input|1=<nowiki>
| |
| sudo apt install qt6-tools-dev
| |
| </nowiki>}}
| |
|
| |
|
| Option 2:
| | === OpenBSD >= 7.5 === |
| {{Input|1=<nowiki>
| |
| sudo apt install apt-file
| |
| sudo apt-file update
| |
| apt-file find Qt6LinguistToolsConfig.cmake
| |
| # qt6-tools-dev: /usr/lib/x86_64-linux-gnu/cmake/Qt6LinguistTools/Qt6LinguistToolsConfig.cmake
| |
| sudo apt install qt6-tools-dev
| |
| </nowiki>}}
| |
| | |
| If the error is:
| |
| {{Input|1=<nowiki>
| |
| The imported target "Qt6::qtwaylandscanner" references the file
| |
| "/usr/lib/qt6/libexec/qtwaylandscanner"
| |
| but this file does not exist.
| |
| </nowiki>}}
| |
| | |
| Then:
| |
| {{Input|1=<nowiki>
| |
| apt-file find /usr/lib/qt6/libexec/qtwaylandscanner
| |
| # qt6-wayland-dev-tools: /usr/lib/qt6/libexec/qtwaylandscanner
| |
| sudo apt install qt6-wayland-dev-tools
| |
| </nowiki>}}
| |
| | |
| Option 3:
| |
| {{Input|1=<nowiki>
| |
| apt search linguist | grep qt6
| |
| # linguist-qt6/kinetic 6.3.1-2 amd64
| |
| sudo apt install linguist-qt6
| |
| </nowiki>}}
| |
| | |
| More examples:
| |
| {{Input|1=<nowiki>
| |
| # Error "Could not find OsmTools (missing: OSMCONVERT_EXECUTABLE
| |
| apt-file search -i OSMCONVERT
| |
| # Returns "osmctools: /usr/bin/osmconvert".
| |
| sudo apt install osmctools
| |
| </nowiki>}}
| |
|
| |
|
| | Install OpenBSD version greater than or equal to 7.5. In the installer keep the defaults, the user created by the installer is named "administrator" in this example. |
| <pre> | | <pre> |
| # Error "Program doxygen found: NO | | # Enable doas |
| # doc/meson.build:6:0: ERROR: Program 'doxygen' not found or not executable"
| | su - |
| apt-file search doxygen | grep "/doxygen$"
| | cp /etc/examples/doas.conf /etc/doas.conf |
| #doxygen: /usr/bin/doxygen
| | exit |
| #polymake-common: /usr/share/polymake/scripts/doxygen
| | # kde-builder needs sudo. |
| sudo apt install doxygen | | mkdir -p ~/.local/bin ; ln -s /usr/bin/doas ~/.local/bin/sudo |
| </pre>
| | echo "export PATH=~/.local/bin:\$PATH" >> ~/.bashrc |
| | |
| === Fedora ===
| |
|
| |
|
| <code>sudo dnf provides "NameOrPathOfFileThatIsMissing"</code>
| | # Test doas. |
| | doas su |
| | # kde-builder needs bash. |
| | pkg_add bash |
| | chsh -s /usr/local/bin/bash |
| | exit |
|
| |
|
| See https://invent.kde.org/redstrate/cmake-package-installer/-/blob/master/src/main.rs
| | # As user administrator |
| | chsh -s /usr/local/bin/bash |
|
| |
|
| E.g. if the error is:
| | # As per https://rsadowski.de/posts/2024-01-09-openbsd-kde/ , https://openports.pl/path/meta/kde,-plasma |
| <pre>
| | doas su |
| Failed to find required Qt component "LinguistTools".
| | pkg_add kde-plasma kate |
|
| |
|
| Expected Config file at
| | # I recommend that you use tigervnc. https://nmariusp.github.io/install-os.html#openbsd--75 |
| "/lib64/cmake/Qt6LinguistTools/Qt6LinguistToolsConfig.cmake" does NOT exist
| |
| </pre> | | </pre> |
|
| |
|
| run:
| | After you install kde-builder: |
| <pre> | | <pre> |
| dnf provides Qt6LinguistToolsConfig.cmake
| | # Edit the kdesrc-buildrc file e.g.: |
| # Error: No matches found. If searching for a file, try specifying the full path
| | cmake-options -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKF_IGNORE_PLATFORM_CHECK=ON |
| # or using a wildcard prefix ("*/") at the beginning.
| |
|
| |
|
| dnf provides */Qt6LinguistToolsConfig.cmake
| | # Also set environment variable: |
| # qt6-qttools-devel-6.5.1-1.fc38.i686 : Development files for qt6-qttools | | export CMAKE_PREFIX_PATH=/usr/local/lib/qt6/cmake |
| # Repo : updates
| | # Or |
| # Matched from: | | export CMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake |
| # Filename : /usr/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsConfig.cmake
| |
| </pre> | | </pre> |
|
| |
|
| == Advanced kdesrc-build == | | === Microsoft Windows === |
|
| |
|
| After you have edited a git repository and you want to build it, <code>--no-src</code> will make sure that <code>kdesrc-build</code> does not overwrite your changes with the latest source code from the official git repository (remote "origin" / https://invent/kde.org).
| | You can build and develop KDE projects using the [[Get_Involved/development/Windows|Microsoft Windows]] operating system. |
|
| |
|
| <code>--no-include-dependencies</code> only builds the git repository that you give as parameter to <code>kdesrc-build</code>.
| | === Apple macOS === |
|
| |
|
| <code>--debug</code> shows verbose output.
| | You can build and develop KDE projects using the [[Get_Involved/development/Mac|Apple macOS]] operating system. |
|
| |
|
| <code>--refresh-build</code> forces a rebuild (not an incremental build) and a full reinstall.
| | == What to do if CMake configure fails because a build dependency is missing == |
|
| |
|
| E.g. you have edited kcalc. You run:
| | See https://community.kde.org/Get_Involved/development/Install_the_dependencies . |
| <pre>
| |
| kdesrc-build kcalc --no-src --no-include-dependencies --refresh-build --debug |& tee ~/a.txt
| |
| </pre>
| |
|
| |
|
| For details, see:
| | == Project Documentation == |
| <pre>
| |
| kdesrc-build --help
| |
| </pre>
| |
|
| |
|
| Note: the resources below might not be up to date.
| | * https://kde-builder.kde.org |
| | * https://invent.kde.org/sdk/kde-builder |
|
| |
|
| See the [https://docs.kde.org/trunk5/en/kdesrc-build/kdesrc-build/ kdesrc-build manual], [https://invent.kde.org/sdk/kdesrc-build/-/blob/master/README.md Readme #1], [https://invent.kde.org/sdk/kdesrc-build/-/blob/master/doc/README.md Readme #2], [https://invent.kde.org/sdk/kdesrc-build/-/blob/master/doc/source-reference/index.adoc Document #3] for more kdesrc-build information and options.
| | == kf6-qt6 vs. kf5-qt5 == |
|
| |
|
| == Build Qt using kdesrc-build ==
| | Many KDE git repositories can build correctly and run correctly using "kde-builder kf6-qt6". |
|
| |
|
| Set up kdesrc-build from scratch as usual.
| | The KDE git repositories that can build correctly and run correctly using "kde-builder kf6-qt6" have two long lived git branches: |
|
| |
|
| Open the configuration file <code>~/.config/kdesrc-buildrc</code> and confirm that <code>qtdir</code> and the lines <code>include...qt5-build-include</code> and <code>include...custom-qt5-libs-build-include</code> are not commented out (i.e. there should not be a <code>#</code> in front of the lines). E.g. (replace "username" with your Linux user's name):
| | * A long lived git branch that does not contain the deprecated symbols from kf5-qt5, named e.g. "master". |
| | * And another long lived git branch for qt5-kf5, where the deprecated symbols still exist. |
|
| |
|
| {{Input|1=<nowiki>
| | What is "kf6-qt6"? You just set up kde-builder following the procedure. The resulting kde-builder installation will be of type kf6-qt6. In kdesrc-buildrc in the "global" section you will have "branch-group kf6-qt6". The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch, will use the git branch where the deprecated symbols do not exist e.g. named "master". |
| qtdir ~/kde/usr # Where to make install Qt5
| |
| include /home/username/kde/src/kdesrc-build/qt5-build-include
| |
| include /home/username/kde/src/kdesrc-build/custom-qt5-libs-build-include
| |
| </nowiki>}}
| |
|
| |
|
| Run in a terminal:
| | What is "kf5-qt5"? Follow the chapter "kde-builder Qt5". The resulting kde-builder installation will be of type kf5-qt5. In kdesrc-buildrc in the "global" section you will have "branch-group kf5-qt5". The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch where the deprecated symbols still exist e.g. named "kf5" will use that. |
|
| |
|
| {{Input|1=<nowiki>
| | == Build Qt using kde-builder == |
| kdesrc-build qt5-set
| |
| kdesrc-build frameworks
| |
| </nowiki>}}
| |
|
| |
|
| == kf5-qt5 vs. kf5-qt6 vs. kf6-qt6 == | | === Qt6 === |
| | If you cannot build the KDE frameworks using {{ic|kde-builder}} and the Qt provided by your Linux distribution is outdated, you might want to build the Qt framework using {{ic|kde-builder}}. |
|
| |
|
| For now, the KDE git repositories from https://invent.kde.org/frameworks and https://invent.kde.org/plasma/ can build correctly and run correctly using "kdesrc-build kf6-qt6".
| | In your configuration file use the {{ic|qt-install-dir}} option (in the ''global'' section) with non-empty value, for example: |
|
| |
|
| The KDE git repositories that can build correctly and run correctly using "kdesrc-build kf6-qt6" have two long lived git branches:
| | {{bc| |
| | global |
| | qt-install-dir ~/kde/usr |
| | branch-group kf6-qt6 |
| | end global |
| | }} |
|
| |
|
| * A long lived git branch that does not contain the deprecated symbols from kf5-qt5, named e.g. "master".
| | It is recommended that if you build Qt6 using kde-builder, you also build qtwebengine. Edit the file {{ic|~/.local/state/sysadmin-repo-metadata/module-definitions/qt6.ksb}}. Follow the instructions found in the file: if you want qtwebengine, add it to use-modules after "qtwebchannel" and comment out the line "ignore-modules qtwebengine". |
| * And another long lived git branch for qt5-kf5 and qt6-kf5, where the deprecated symbols still exist.
| |
|
| |
|
| What is "kf5-qt5"? You just set up kdesrc-build following the procedure. The resulting kdesrc-build installation will be of type kf5-qt5. In kdesrc-buildrc in the "global" section you will have "branch-group kf5-qt5". The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch where the deprecated symbols still exist e.g. named "kf5" will use that.
| | <pre> |
| | kde-builder qtbase --refresh-build --debug |
| | </pre> |
| | Press Ctrl+C after the CMake configure summary for qtbase. Make sure that you have the needed dependencies. Should find libb2-dev, libproxy-dev, libmd4c-dev, libmd4c-html0-dev, libxcb-xinput-dev, libatspi2.0-dev, libsqlite3-dev, unixodbc-dev, libmysqlclient-dev, postgresql-client, libecpg-dev, libpq-dev. Optional dependencies libsctp-dev, libts-dev. |
|
| |
|
| What is "kf5-qt6"? "kf5-qt6" is not supported and should not be used. You just set up kdesrc-build following the procedure. The resulting kdesrc-build installation will be of type kf5-qt5. In kdesrc-buildrc in the "global" section you will have "branch-group kf5-qt5", you keep this unchanged. You edit kdesrc-buildrc to make kdesrc-build use Qt6 instead of Qt5. The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch where the deprecated symbols still exist e.g. named "kf5" will use that.
| |
|
| |
| What is "kf6-qt6"? You just set up kdesrc-build following the procedure. The resulting kdesrc-build installation will be of type kf5-qt5. In kdesrc-buildrc in the "global" section you will have "branch-group kf5-qt5", you replace that with "branch-group kf6-qt6". You edit kdesrc-buildrc to make kdesrc-build use Qt6 instead of Qt5. The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch, will use the git branch where the deprecated symbols do not exist e.g. named "master".
| |
|
| |
| === Why kdesrc-build kf6-qt6 cannot build and run neochat correctly? ===
| |
|
| |
| neochat does not have a second long lived git branch where the deprecated symbols do not exist.
| |
|
| |
| <code>kdesrc-build neochat</code> for kf6-qt6 succeeds, but then <code>kdesrc-run neochat</code> for kf6-qt6 fails because
| |
| <pre> | | <pre> |
| qrc:/RoomListContextMenu.qml:200:27: Invalid property assignment: unsupported type "QQuickIcon"
| | kde-builder qtwebengine |
| Segmentation fault (core dumped)
| |
| </pre> | | </pre> |
| | This will build the Qt6 modules from qtbase up to qtwebengine. qtwebengine will probably be built incorrectly because some needed dependencies are missing. |
|
| |
|
| <pre> | | <pre> |
| # The file ~/kde/src/neochat/src/qml/Menu/RoomListContextMenu.qml at line 200 says:
| | kde-builder qtwebengine --refresh-build --debug |
| Kirigami.BasicListItem {
| |
| text: i18n("Mark as Read")
| |
| icon: "checkmark"
| |
| </pre> | | </pre> |
| | Press Ctrl+C after the CMake configure summary for qtwebengine. Make sure that you have the needed dependencies. Should find node.js >= 14, libdbus-1-dev, libxcomposite-dev, libxshmfence-dev, libxdamage-dev, libharfbuzz-dev, libvpx-dev, libpci-dev, libevent-dev, libre2-dev, libsnappy-dev, libcups2-dev, libxkbfile-dev. |
|
| |
|
| The symbol <code>Kirigami.BasicListItem.icon</code> of type string is deprecated and exists in kf5-qt5. In kf6-qt6 we use the symbol of type string <code>Kirigami.BasicListItem.icon.name</code>.
| | Then build Qt6: {{bc|kde-builder qt6-set}} |
|
| |
|
| == kdesrc-build, Qt6 and KDE Frameworks 6 ==
| | To compile Qt6 with Qt X11 Extras (which is a necessary library to compile [https://api.kde.org/frameworks/kwindowsystem/html/ KWindowSystem]), you should enable XCB feature during compilation |
|
| |
|
| === Using kdesrc-buildrc-kf6-sample === | | {{bc|1=kde-builder qt6-set --cmake-options="-DQT_FEATURE_xcb=ON"}} |
| KDE projects are currently transitioning to use Qt6. You can build the in-development Qt6 versions using kdesrc-build by adjusting the .config/kdesrc-buildrc file. You can find a sample kdesrc-buildrc file [https://invent.kde.org/sdk/kdesrc-build/-/blob/master/kdesrc-buildrc-kf6-sample here].
| |
|
| |
|
| The important differences to Qt5 are:
| | === Qt5 === |
| | If you want the same for Qt5, change {{ic|branch-group}} option and use {{ic|qt5-set}} instead of {{ic|qt6-set}}. |
|
| |
|
| <code>branch-group kf6-qt6</code>: This will check out the correct git branches.
| | == Qt 6 installed using the Qt online installer == |
|
| |
|
| <code>prefix ~/kde6/usr</code>: It is recommended to use a different prefix for Qt6-based builds than for the Qt5-based builds
| | A screen recording version is available https://www.youtube.com/watch?v=3BIbYN2vIZw |
|
| |
|
| Save the file e.g. as <code>/home/user/kde6/kdesrc-buildrc</code>.
| | The homepage of the Qt Framework is https://www.qt.io . Go to this web page, create an online account. https://www.qt.io/download-open-source > "Download the Qt Online Installer" > Linux > "Qt Online Installer for Linux (64-bit)" > download a file named e.g. qt-unified-linux-x64-4.6.1-online.run into the directory e.g. "~/Downloads". |
|
| |
|
| Then you can use <code>kdesrc-build --rc-file=/home/user/kde6/kdesrc-buildrc ...</code> to build things against Qt6
| | <pre> |
| | ls -la ~/Downloads # The downloaded file needs to have the "executable" chmod bit set. |
| | chmod u+x ~/Downloads/qt-unified-linux-x64-4.6.1-online.run |
| | ~/Downloads/qt-unified-linux-x64-4.6.1-online.run |
| | </pre> |
|
| |
|
| === Editing ~/.config/kdesrc-buildrc ===
| | A graphical user interface (GUI) installer wizard starts. Login using your Qt online account. Next > check the checkbox "I have read and agree to the terms and conditions of using OpenSource Qt", check the checkbox "I'm an individual and do not use Qt for any company" > Next > Next > enable "Help us improve" > Next > Custom installation, notice that the install directory is "~/Qt" > Next. Install the latest version of Qt6 and the latest version of the Qt Creator integrated development environment (IDE). There are some Qt6 components that are not used by KDE and can be left out when installing Qt6 e.g. Qt Design Studio, WebAssembly, Android, Sources, Qt Quick 3D, Qt 3D, Qt Quick 3D Physics, "Qt Debug Information Files". Next > enable "I have read and agree" > Next > Install. |
|
| |
|
| Set up kdesrc-build following the "Set up kdesrc-build" procedure. The resulting kdesrc-build installation will be of type kf5-qt5. In kdesrc-buildrc in the "global" section you will have "branch-group kf5-qt5".
| | In the KDE Plasma app launcher (start menu) you now have the application "Qt Maintenance Tool". |
|
| |
|
| Edit the file <code>~/.config/kdesrc-buildrc</code>
| | Set up kde-builder from scratch as usual. |
| * Replace all "5" with "6".
| |
| * Replace:
| |
| <pre>cmake-options -DCMAKE_BUILD_TYPE=RelWithDebInfo</pre>
| |
| with:
| |
| <pre>cmake-options -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQT_MAJOR_VERSION=6 -DBUILD_WITH_QT6=ON</pre>
| |
|
| |
|
| == Packages needed by kdesrc-build kf6-qt6 ==
| | Edit the file kdesrc-buildrc to look like: |
|
| |
|
| "kdesrc-build --initial-setup" should install from your Operating System (OS) at least the packages that are needed for "kdesrc-build frameworks" to succeed.
| |
|
| |
| "kdesrc-build --initial-setup" by default sets up kdesrc-build kf5-qt5 and installs packages from your OS that are needed for kdesrc-build kf5-qt5.
| |
|
| |
| Below is the list of OS packages that kdesrc-build would install if it knew how to set up kdesrc-build kf6-qt6.
| |
|
| |
| * Debian/Ubuntu:
| |
| <pre> | | <pre> |
| sudo apt install qt6-tools-dev qt6-declarative-dev libqt6core5compat6-dev qt6-wayland qt6-wayland-dev qt6-wayland-dev-tools qt6-base-private-dev libqt6svg6-dev libqt6opengl6-dev libqt6shadertools6-dev doxygen xsltproc xmlto texinfo libcanberra-dev
| | global |
| sudo apt build-dep appstream
| | ... |
| | qt-install-dir ~/Qt/6.7.0/gcc_64 # Where to install Qt6 if kdesrc-build supplies it |
| | libname lib |
| | ... |
| | end global |
| </pre> | | </pre> |
|
| |
|
| * openSUSE Tumbleweed: <code>sudo zypper in patterns-kde-devel_qt6 qt6-wayland-private-devel</code>
| | == Two independent kde-builder configurations: kf6-qt6 and kf5-qt5 == |
| * Arch Linux: <code>sudo pacman -S poppler-qt6 qca-qt6 qt6-5compat qt6-base qt6-charts qt6-declarative qt6-multimedia qt6-multimedia-ffmpeg qt6-positioning qt6-tools qt6-translations qt6-wayland qt6-webchannel qt6-webengine qt6-websockets qt6-webview qtkeychain-qt6 qcoro-qt6 qt6-svg qt6-shadertools</code>
| |
| * Fedora: <code>sudo dnf install qt6-qtwebengine-devel qt6-qt5compat-devel qt6-qtbase-devel qt6-qtbase-private-devel qt6-qtdeclarative-devel qt6-qtlocation-devel qt6-qtmultimedia-devel qt6-qtpositioning-devel qt6-qtwayland-devel qt6-qttools qt6-qtshadertools-devel qt6-qtsvg-devel qt6-linguist qt6-qttools-devel qt6-qtwebsockets-devel expat-devel libcurl-devel libyaml-devel gtk-doc</code>
| |
| * FreeBSD: <code>sudo pkg install qt6</code>
| |
| | |
| == Build Qt6 using kdesrc-build ==
| |
| | |
| A screen recording version is available https://www.youtube.com/watch?v=TDzX0376QyA
| |
| | |
| Note: If you cannot build the KDE frameworks using kdesrc-build and using the Qt6 provided by your OS (Linux distribution). Because the Qt6 is not complete. You might want to build Qt6 using kdesrc-build.
| |
| | |
| Note: Building Qt6 using kdesrc-build is an advanced topic.
| |
| | |
| Set up kdesrc-build clean from scratch following the same procedure as when using "Qt5 and KDE Frameworks 5".
| |
| | |
| Edit two files.
| |
| | |
| <code>~/.config/kdesrc-buildrc</code>:
| |
| {{Input|1=
| |
| <span style="color: #585858;"># This file controls options to apply when configuring/building modules, and</span>
| |
| <span style="color: #585858;"># controls which modules are built in the first place.</span>
| |
| <span style="color: #585858;"># List of all options: https://docs.kde.org/trunk5/en/kdesrc-build/kdesrc-build/conf-options-table.html</span>
| |
| | |
| <span style="color: #00875f; font-weight: bold;">global</span>
| |
| <span style="color: #008787;">branch-group</span> <span style="color: #875f5f;">kf6-qt6</span>
| |
| | |
| <span style="color: #585858;"># Finds and includes *KDE*-based dependencies into the build. This makes</span>
| |
| <span style="color: #585858;"># it easier to ensure that you have all the modules needed, but the</span>
| |
| <span style="color: #585858;"># dependencies are not very fine-grained so this can result in quite a few</span>
| |
| <span style="color: #585858;"># modules being installed that you didn't need.</span>
| |
| <span style="color: #008787;">include-dependencies</span> <span style="color: #875f5f;">true</span>
| |
| | |
| <span style="color: #585858;"># Install directory for KDE software</span>
| |
| <span style="color: #008787;">kdedir</span> <span style="color: #875f5f;">~/kde/usr</span>
| |
| | |
| <span style="color: #585858;"># Directory for downloaded source code</span>
| |
| <span style="color: #008787;">source-dir</span> <span style="color: #875f5f;">~/kde/src</span>
| |
| | |
| <span style="color: #585858;"># Directory to build KDE into before installing</span>
| |
| <span style="color: #585858;"># relative to source-dir by default</span>
| |
| <span style="color: #008787;">build-dir</span> <span style="color: #875f5f;">~/kde/build</span>
| |
| | |
| <span style="color: #008787;">qtdir</span> <span style="color: #875f5f;">~/kde/usr</span> <span style="color: #585858;"># Where to install Qt5 if kdesrc-build supplies it</span>
| |
| | |
| <span style="color: #008787;">cmake-options</span> <span style="color: #875f5f;">-DCMAKE_BUILD_TYPE=Debug -DQT_MAJOR_VERSION=6 -DBUILD_WITH_QT6=ON</span>
| |
| | |
| <span style="color: #585858;"># kdesrc-build sets 2 options which is used in options like make-options or set-env</span>
| |
| <span style="color: #585858;"># to help manage the number of compile jobs that happen during a build:</span>
| |
| <span style="color: #585858;">#</span>
| |
| <span style="color: #585858;"># 1. num-cores, which is just the number of detected CPU cores, and can be passed</span>
| |
| <span style="color: #585858;"># to tools like make (needed for parallel build) or ninja (completely optional).</span>
| |
| <span style="color: #585858;">#</span>
| |
| <span style="color: #585858;"># 2. num-cores-low-mem, which is set to largest value that appears safe for</span>
| |
| <span style="color: #585858;"># particularly heavyweight modules based on total memory, intended for</span>
| |
| <span style="color: #585858;"># modules like qtwebengine</span>
| |
| <span style="color: #008787;">num-cores</span> <span style="color: #875f5f;">16</span>
| |
| <span style="color: #008787;">num-cores-low-mem</span> <span style="color: #875f5f;">12</span>
| |
| | |
| <span style="color: #585858;"># kdesrc-build can install a sample .xsession file for "Custom"</span>
| |
| <span style="color: #585858;"># (or "XSession") logins,</span>
| |
| <span style="color: #008787;">install-session-driver</span> <span style="color: #875f5f;">false</span>
| |
| | |
| <span style="color: #585858;"># or add a environment variable-setting script to</span>
| |
| <span style="color: #585858;"># ~/.config/kde-env-master.sh</span>
| |
| <span style="color: #008787;">install-environment-driver</span> <span style="color: #875f5f;">true</span>
| |
| | |
| <span style="color: #585858;"># Stop the build process on the first failure</span>
| |
| <span style="color: #008787;">stop-on-failure</span> <span style="color: #875f5f;">true</span>
| |
| | |
| <span style="color: #585858;"># Use a flat folder layout under ~/kde/src and ~/kde/build</span>
| |
| <span style="color: #585858;"># rather than nested directories</span>
| |
| <span style="color: #008787;">directory-layout</span> <span style="color: #875f5f;">flat</span>
| |
| | |
| <span style="color: #585858;"># Build with LSP support for everything that supports it</span>
| |
| <span style="color: #008787;">compile-commands-linking</span> <span style="color: #875f5f;">true</span>
| |
| <span style="color: #008787;">compile-commands-export</span> <span style="color: #875f5f;">true</span>
| |
| | |
| <span style="color: #008787;">git-repository-base</span> <span style="color: #875f5f;">qt6-copy https://invent.kde.org/qt/qt/</span>
| |
| <span style="color: #00875f; font-weight: bold;">end global</span>
| |
| | |
| <span style="color: #585858;"># With base options set, the remainder of the file is used to define modules to build, in the</span>
| |
| <span style="color: #585858;"># desired order, and set any module-specific options.</span>
| |
| <span style="color: #585858;">#</span>
| |
| <span style="color: #585858;"># Modules may be grouped into sets, and this is the normal practice.</span>
| |
| <span style="color: #585858;">#</span>
| |
| <span style="color: #585858;"># You can include other files inline using the "include" command. We do this here</span>
| |
| <span style="color: #585858;"># to include files which are updated with kdesrc-build.</span>
| |
| | |
| <span style="color: #585858;"># Common options that should be set for some KDE modules no matter how</span>
| |
| <span style="color: #585858;"># kdesrc-build finds them. Do not comment these out unless you know</span>
| |
| <span style="color: #585858;"># what you are doing.</span>
| |
| <span style="color: #00875f; font-weight: bold;">include</span> <span style="color: #875f5f;">/home/username/kde/src/kdesrc-build/kf6-common-options-build-include</span>
| |
| | |
| <span style="color: #585858;"># Qt and some Qt-using middleware libraries. Uncomment if your distribution's Qt</span>
| |
| <span style="color: #585858;"># tools are too old but be warned that Qt take a long time to build!</span>
| |
| <span style="color: #585858;"># comment next line after building, to not accidently rebuild qt6</span>
| |
| <span style="color: #00875f; font-weight: bold;">include</span> <span style="color: #875f5f;">/home/username/kde/src/kdesrc-build/qt6-build-include</span>
| |
| <span style="color: #585858;"># keep next line uncommented for both builds (kf6 and qt6)</span>
| |
| <span style="color: #00875f; font-weight: bold;">include</span> <span style="color: #875f5f;">/home/username/kde/src/kdesrc-build/custom-qt6-libs-build-include</span>
| |
| | |
| <span style="color: #585858;"># KF6 and Plasma :)</span>
| |
| <span style="color: #585858;"># keep next line commented for building qt6 build; later uncomment for kf6 build</span>
| |
| <span style="color: #585858;">#include /home/username/kde/src/kdesrc-build/kf6-qt6-build-include</span>
| |
| | |
| <span style="color: #585858;"># To change options for modules that have already been defined, use an</span>
| |
| <span style="color: #585858;"># 'options' block. See kf6-common-options-build-include for an example</span>
| |
| | |
| <span style="color: #585858;"># vim: set ft=kdesrc-buildrc:</span>
| |
| }}
| |
| | |
| <code>~/kde/src/kdesrc-build/qt6-build-include</code>:
| |
| {{Input|1=
| |
| <span style="color: #585858;"># Downloads and installs Qt6 from the KDE mirror, using Qt6's CMake support</span>
| |
| <span style="color: #585858;"># exclusively. Consider this an unofficial build that won't be supported by Qt</span>
| |
| <span style="color: #585858;"># upstream since we don't go through the init-repository script.</span>
| |
| <span style="color: #585858;"># It is probably better to install from your local distribution devel packages</span>
| |
| <span style="color: #585858;"># if possible!</span>
| |
| <span style="color: #00875f; font-weight: bold;">module-set</span> qt6-set
| |
| <span style="color: #008787;">override-build-system</span> <span style="color: #875f5f;">qt6</span> <span style="color: #585858;"># technically optional for now</span>
| |
| | |
| <span style="color: #008787;">repository</span> <span style="color: #875f5f;">qt6-copy</span> <span style="color: #585858;"># as defined in kdesrc-buildrc-kf6-sample</span>
| |
| <span style="color: #008787;">branch</span> <span style="color: #875f5f;">6.4</span>
| |
| | |
| <span style="color: #585858;"># Controls where Qt6 is installed</span>
| |
| <span style="color: #008787;">prefix</span> <span style="color: #875f5f;">${qtdir}</span>
| |
| | |
| <span style="color: #585858;"># These have been manually placed in dependency order based on the</span>
| |
| <span style="color: #585858;"># .gitmodules file in https://code.qt.io/cgit/qt/qt5.git/tree/.gitmodules</span>
| |
| <span style="color: #585858;"># in "essential" or "addons" categories with some additions</span>
| |
| <span style="color: #585858;"># qtdoc should be last to give it best opportunity to make needed docs</span>
| |
| <span style="color: #008787;">use-modules</span> <span style="color: #875f5f;">qtbase qttools qtshadertools qtdeclarative qtsvg </span><span style="color: #ff8700;">\</span>
| |
| <span style="color: #875f5f;"> qtimageformats qtmultimedia qtwayland </span><span style="color: #ff8700;">\</span>
| |
| <span style="color: #875f5f;"> qtwebsockets qtwebchannel qtwebengine qtwebview qtsensors </span><span style="color: #ff8700;">\</span>
| |
| <span style="color: #875f5f;"> qtnetworkauth qt5compat qtdoc qtpositioning </span><span style="color: #ff8700;">\</span>
| |
| <span style="color: #875f5f;"> qtlocation qtvirtualkeyboard</span>
| |
| | |
| <span style="color: #585858;"># if you want qtwebengine, add it to use-modules after "qtwebchannel" and</span>
| |
| <span style="color: #585858;"># comment this out. Note qtwebengine has significant and different build</span>
| |
| <span style="color: #585858;"># requirements of its own.</span>
| |
| <span style="color: #585858;">#ignore-modules qtwebengine</span>
| |
|
| |
|
| <span style="color: #585858;"># Archiving API requires zstd support which may not be present in your CMake</span>
| | You can switch between configurations with {{ic|--rc-file}} command line option. Generate another config, make the changes for the {{ic|source-dir}}, {{ic|build-dir}}, {{ic|install-dir}}, |
| <span style="color: #008787;">cmake-options</span> <span style="color: #875f5f;">-DQT_BUILD_TESTS=FALSE -DCMAKE_BUILD_TYPE=RelWithDebInfo </span><span style="color: #ff8700;">\</span>
| | and other changes you want. Make sure you use different value for {{ic|persistent-data-file}} option, to not mix things up. |
| <span style="color: #875f5f;"> -DQT_AVOID_CMAKE_ARCHIVING_API=TRUE</span>
| |
|
| |
|
| <span style="color: #008787;">cmake-generator</span> <span style="color: #875f5f;">Ninja</span> <span style="color: #585858;"># comment out if you want the default CMake generator</span>
| | As an alternative, you can utilize custom variable to make switch from a single config: |
| <span style="color: #00875f; font-weight: bold;">end module-set</span>
| |
|
| |
|
| <span style="color: #00875f; font-weight: bold;">options</span> qtwebengine
| | {{bc-hl|shell| |
| <span style="color: #585858;"># qtwebengine build system is weird, involving make as the top-level driver</span> | | global |
| <span style="color: #585858;"># and then calling ninja for the bulk of the build. qtwebengine is a bulky</span> | | _ver 5 # <-- Change this to switch |
| <span style="color: #585858;"># module and having ninja use all cores at once may run out of memory if</span> | | source-dir ~/kde${_ver}/src |
| <span style="color: #585858;"># not careful, so we use make to pass less aggressive Ninja flags.</span>
| | build-dir ~/kde${_ver}/build |
| <span style="color: #585858;"># num-cores-low-mem needs to be defined in your kdesrc-buildrc.</span> | | install-dir ~/kde${_ver}/usr |
| <span style="color: #008787;">make-options</span> <span style="color: #875f5f;">NINJAFLAGS=-j${num-cores-low-mem}</span> | | persistent-data-file ~/kde${_ver}/persistent-options.json |
| <span style="color: #00875f; font-weight: bold;">end options</span>
| | end global |
|
| |
|
| <span style="color: #585858;"># vim: set ft=kdesrc-buildrc: </span>
| | include ~/.local/share/kdesrc-build/data/build-include/kf${_ver}-qt${_ver}.ksb |
| }} | | }} |
|
| |
| == Portable installation of kdesrc-build ==
| |
|
| |
| The current directory (pwd) is important when running kdesrc-build. If there exists a file kdesrc-buildrc in the the current directory (pwd), kdesrc-build will prefer that file over ~/.config/kdesrc-buildrc.
| |
|
| |
| If you are interested in or need separate builds of KDE software, like when building with Qt5 or Qt6, you can create a self-contained, portable installation of kdesrc-build in its own folder. This way, you can manage your kdesrc-build configuration files each in their own environment without mixing configurations or having to rebuild the universe every time you want to test a different one.
| |
|
| |
| {{Input|1=<nowiki>
| |
| # To not lose your previous build, make a backup:
| |
| mv ~/.config/kdesrc-buildrc ~/.config/kdesrc-buildrc~bak && mv ~/kde ~/kde~bak
| |
| # Edit ~/.bashrc file and remove the kdesrc-build block.
| |
| # Set up kdesrc-build by following just the chapter https://community.kde.org/Get_Involved/development#Set_up_kdesrc-build
| |
| # Make sure to answer "No" when it asks if you want to add the kdesrc-build block to ~/.bashrc.
| |
| # Do not source ~/.bashrc.
| |
| # Edit ~/.bashrc file and remove the kdesrc-build block.
| |
| # Reboot the computer or relogin such that the $PATH environment variable
| |
| # does not contain the string "~/kde" or sub directories of "~/kde".
| |
| # You should not have built anything using kdesrc-build yet.
| |
| # Then move the generated kdesrc-buildrc to inside the new ~/kde folder:
| |
| mv ~/.config/kdesrc-buildrc ~/kde
| |
| # This will make kdesrc-build use this file even if ~/.config/kdesrc-buildrc exists.
| |
| # Then link kdesrc-build and kdesrc-run to the root of the ~/kde folder:
| |
| cd ~/kde
| |
| ln -s src/kdesrc-build/kdesrc-build .
| |
| ln -s src/kdesrc-build/kdesrc-run .
| |
| # Edit the file paths in ~/kde/kdesrc-buildrc
| |
| cd ~/kde
| |
| # Calling ~/kde/kdesrc-build will then only use the current folder's kdesrc-buildrc:
| |
| ./kdesrc-build frameworks
| |
| mv ~/kde ~/kde.5 # Or to any other directory.
| |
| # Edit the file paths in the file ~/kde.5/kdesrc-buildrc
| |
| cd ~/kde.5
| |
| ./kdesrc-build frameworks --refresh-build # Because binary files contain file full paths starting with "~/kde".
| |
| </nowiki>}}
| |
|
| |
| == Two independent kdesrc-build installations on the same machine: kf6-qt6 and kf5-qt5 ==
| |
|
| |
| Make a backup of your existing kdesrc-build setup.
| |
| <code>mv ~/.config/kdesrc-buildrc ~/.config/kdesrc-buildrc~bak && mv ~/kde ~/kde~bak</code>
| |
|
| |
| Set up a portable kdesrc-build from scratch in the directory <code>~/kde</code>. See the chapter [[#Portable installation of kdesrc-build]] for details. But do not run kdesrc-build to build anything.
| |
|
| |
| In the directory <code>~/kde</code> there will be a new kdesrc-build installation of type <code>kf5-qt5</code>.
| |
|
| |
| At the end of this procedure there will be two independent and portable kdesrc-build installations:
| |
| * <code>~/kde5</code> - <code>kf5-qt5</code>
| |
| * <code>~/kde6</code> - <code>kf6-qt6</code>
| |
|
| |
| {{Input|1=<nowiki>
| |
| # kf5-qt5 kdesrc-build installation.
| |
| cp ~/kde ~/kde5 # Or to any other directory.
| |
| # Edit the file paths in the file ~/kde5/kdesrc-buildrc to point to "~/kde5" instead of "~/kde".
| |
| cd ~/kde5
| |
| ./kdesrc-build frameworks --refresh-build # Because binary files contain file full paths starting with "~/kde".
| |
| # Now you have a kdesrc-build kf5-qt5 installation in ~/kde5
| |
|
| |
| # kf6-qt6 kdesrc-build installation.
| |
| mv ~/kde ~/kde6 # Or to any other directory.
| |
| # Edit the file ~/kde6/kdesrc-buildrc such that the kdesrc-build installation becomes one of type kf6-qt6.
| |
| # See this wiki page for examples on how to convert a kf5-qt5 kdesrc-build installation to a kf6-qt6 kdesrc-build installation.
| |
| # Edit the file paths in the file ~/kde6/kdesrc-buildrc to point to "~/kde6" instead of "~/kde".
| |
| cd ~/kde6
| |
| ./kdesrc-build frameworks --refresh-build # Because binary files contain file full paths starting with "~/kde".
| |
| # Now you have a kdesrc-build kf6-qt6 installation in ~/kde6
| |
| </nowiki>}}
| |
|
| |
| Usage:
| |
|
| |
| {{Input|1=<nowiki>
| |
| # Use different terminal windows or tabs (e.g. different Konsole tabs) for
| |
| # kf5-qt5 and kf6-qt6
| |
|
| |
| # Go to the terminal window or tab for kf5-qt5.
| |
| cd ~/kde5
| |
| ./kdesrc-build kcalc
| |
| ./kdesrc-run kcalc
| |
|
| |
| # Go to the terminal window or tab for kf6-qt6.
| |
| cd ~/kde6
| |
| ./kdesrc-build plasma-systemmonitor
| |
| ./kdesrc-run plasma-systemmonitor
| |
| </nowiki>}}
| |
|
| |
| == What is the command line of the processes started by kdesrc-build ==
| |
|
| |
| E.g. what are the command lines that are run by kdesrc-build in order to run the CMake configure step for the kconfig KDE git repository?
| |
|
| |
| {{Input|1=<nowiki>
| |
| kdesrc-build kconfig --no-src --no-include-dependencies --debug --refresh-build |& tee ~/a.txt
| |
| kate ~/a.txt &
| |
| </nowiki>}}
| |
|
| |
| Returns:
| |
|
| |
| {{Input|1=<nowiki>
| |
| Building kconfig (build system KDE CMake) from frameworks (1/1)
| |
| Queueing PKG_CONFIG_PATH to be set to /home/username/kde/usr/lib/pkgconfig
| |
| Queueing LD_LIBRARY_PATH to be set to /home/username/kde/usr/lib
| |
| Queueing PATH to be set to /home/username/kde/usr/bin:/home/username/kde/src/kdesrc-build:/home/username/.local/bin:/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
| |
| Not prepending /home/username/kde/usr/lib/pkgconfig to PKG_CONFIG_PATH as it appears to already be defined in PKG_CONFIG_PATH.
| |
| Queueing PKG_CONFIG_PATH to be set to /home/username/kde/usr/lib/pkgconfig
| |
| Not prepending /home/username/kde/usr/lib to LD_LIBRARY_PATH as it appears to already be defined in LD_LIBRARY_PATH.
| |
| Queueing LD_LIBRARY_PATH to be set to /home/username/kde/usr/lib
| |
| Not prepending /home/username/kde/usr/bin to PATH as it appears to already be defined in PATH.
| |
| Queueing PATH to be set to /home/username/kde/usr/bin:/home/username/kde/src/kdesrc-build:/home/username/.local/bin:/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
| |
| Queueing CMAKE_PREFIX_PATH to be set to /home/username/kde/usr
| |
| Queueing CMAKE_MODULE_PATH to be set to /home/username/kde/usr/lib64/cmake:/home/username/kde/usr/lib/cmake
| |
| Queueing XDG_DATA_DIRS to be set to /home/username/kde/usr/share:/usr/share/plasma:/home/username/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
| |
| Source update complete for kconfig: Skipped
| |
| cd /home/username/kde/build
| |
|
| |
| Preparing build system for kconfig.
| |
| Removing files in build directory for kconfig
| |
| Old build system cleaned, starting new build system.
| |
| cd /home/username/kde/build/kconfig
| |
|
| |
| Running cmake targeting Unix Makefiles...
| |
| run_logged_p(): Module kconfig, Command: {'cmake', '-B', '.', '-S', '/home/username/kde/src/kconfig', '-G', 'Unix Makefiles', '-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON', '-DCMAKE_BUILD_TYPE=Debug', '-DQT_MAJOR_VERSION=6', '-DBUILD_WITH_QT6=ON', '-DBUILD_TESTING=TRUE', '-DBUILD_WITH_QT6=ON', '-DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.99.0', '-DCMAKE_CXX_FLAGS:STRING=-pipe', '-DCMAKE_INSTALL_PREFIX=/home/username/kde/usr'} from /home/username/kde/build/kconfig
| |
| cd /home/username/kde/build/kconfig
| |
|
| |
| log_command(): Module kconfig, Command: cmake -B . -S /home/username/kde/src/kconfig -G Unix Makefiles -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DQT_MAJOR_VERSION=6 -DBUILD_WITH_QT6=ON -DBUILD_TESTING=TRUE -DBUILD_WITH_QT6=ON -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.99.0 -DCMAKE_CXX_FLAGS:STRING=-pipe -DCMAKE_INSTALL_PREFIX=/home/username/kde/usr
| |
| run_logged_p(): kconfig cmake complete: 0
| |
| </nowiki>}}
| |
|
| |
| Therefore, kdesrc-build has run the following commands:
| |
|
| |
| {{Input|1=<nowiki>
| |
| # Preparing build system for kconfig. Removing files in build directory for kconfig. Old build system cleaned, starting new build system.
| |
| rm -rf /home/username/kde/build/kconfig
| |
| mkdir -p /home/username/kde/build/kconfig
| |
|
| |
| # Queueing X to be set to ...
| |
| PKG_CONFIG_PATH=/home/username/kde/usr/lib/pkgconfig
| |
| LD_LIBRARY_PATH=/home/username/kde/usr/lib
| |
| PATH=/home/username/kde/usr/bin:/home/username/kde/src/kdesrc-build:/home/username/.local/bin:/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
| |
| CMAKE_PREFIX_PATH=/home/username/kde/usr
| |
| CMAKE_MODULE_PATH=/home/username/kde/usr/lib64/cmake:/home/username/kde/usr/lib/cmake
| |
| XDG_DATA_DIRS=/home/username/kde/usr/share:/usr/share/plasma:/home/username/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
| |
|
| |
| cd /home/username/kde/build/kconfig
| |
|
| |
| cmake -B . -S /home/username/kde/src/kconfig -G Unix\ Makefiles -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DQT_MAJOR_VERSION=6 -DBUILD_WITH_QT6=ON -DBUILD_TESTING=TRUE -DBUILD_WITH_QT6=ON -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.99.0 -DCMAKE_CXX_FLAGS:STRING=-pipe -DCMAKE_INSTALL_PREFIX=/home/username/kde/usr
| |
| </nowiki>}}
| |
|
| |
| == How to write the entire verbose STDOUT and STDERR of kdesrc-build to a file ==
| |
|
| |
| <pre>
| |
| script -eq -c "kdesrc-build kconfig --no-src --no-include-dependencies --refresh-build --debug" ~/a.txt
| |
| </pre>
| |
|
| |
| Note: you can remove the terminal ANSI color codes using e.g. <code>ansi2txt</code>, available e.g. in the package <code>colorized-logs</code>. E.g.
| |
| <pre>
| |
| sudo apt install colorized-logs
| |
| cat ~/a.txt | ansi2txt > ~/a_script.txt
| |
| </pre>
| |
|
| |
| <code>script -eq -c "command" ~/a.txt</code> is better than <code>command |& tee ~/a.txt</code> because kdesrc-build behaves differently if it is run in a user interactive terminal session (<code>isatty</code>).
| |
|
| |
| If using <code>tee</code>, part of the output of kdesrc-build will not be written to file. E.g. the output of the <code>cmake</code> step, the final part of the <code>make -j</code> step, the final part of the <code>make install</code> step.
| |
|
| |
|
| == Other CPU architectures than x86_64/amd64 and x86 == | | == Other CPU architectures than x86_64/amd64 and x86 == |
Line 611: |
Line 211: |
| You can build and develop KDE projects using a Linux OS installed on an [[Get_Involved/development/ARM|ARM]] architecture CPU. | | You can build and develop KDE projects using a Linux OS installed on an [[Get_Involved/development/ARM|ARM]] architecture CPU. |
|
| |
|
| == kdesrc-build issues == | | == kde-builder issues == |
| | |
| === "kdesrc-build kfilemetadata" fails because of appimage ===
| |
| | |
| This happens on KDE neon.
| |
| | |
| Solution:
| |
| <pre>
| |
| sudo apt remove libappimage-dev
| |
| </pre>
| |
| | |
| === wayland-protocols is too old, e.g. "kdesrc-build kidletime" fails ===
| |
| | |
| <pre>
| |
| mkdir -p ~/kde/misc && cd ~/kde/misc
| |
| wget https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.31/downloads/wayland-protocols-1.31.tar.xz
| |
| tar -xJvf wayland-protocols-*.tar.xz && mv wayland-protocols-*/ wayland-protocols
| |
| cd wayland-protocols
| |
| meson setup builddir --prefix $HOME/kde/usr
| |
| meson compile -C builddir
| |
| meson install -C builddir
| |
| </pre>
| |
|
| |
|
| === "kdesrc-build kpat" fails because of black-hole-solitaire === | | === "kde-builder kpat" fails because of black-hole-solitaire === |
|
| |
|
| This happens on Debian/Ubuntu/Kubuntu. Because there is no Linux distribution binary package for https://github.com/shlomif/black-hole-solitaire. | | This happens on Debian/Ubuntu/Kubuntu. Because there is no Linux distribution binary package for https://github.com/shlomif/black-hole-solitaire. |
Line 643: |
Line 222: |
| cmake-options -DWITH_BH_SOLVER=OFF | | cmake-options -DWITH_BH_SOLVER=OFF |
| end options | | end options |
| </pre>
| |
|
| |
| === "kdesrc-build frameworks" fails because of qtwebkit ===
| |
|
| |
| Note: qtwebkit and kdewebkit are Qt5 only.
| |
|
| |
| Some Linux OSes do not have a package for qtwebkit anymore. E.g. the Arch Linux family.
| |
|
| |
| When you want to build all of the KDE Frameworks 5 using kdesrc-build, exclude kdewebkit.
| |
|
| |
| <pre>
| |
| kdesrc-build frameworks --ignore-modules kdewebkit
| |
| </pre> | | </pre> |
|
| |
|
This page is the continuation with more advanced topics of the page Get_Involved/development.
kde-builder has replaced the previous KDE build framework named kdesrc-build.
Develop in a Linux container
When you start programming for KDE, it is recommended that you use kde-builder in your main operating system or in a virtual machine running on a Linux operating system that is better supported by kde-builder.
As an alternative, you can run kde-builder in a Linux container (docker, podman, toolbx, distrobox).
Option 1. The KDE PIM Docker image
You can install Docker and the KDE PIM Docker image. It provides a development environment that is isolated from your day-to-day system. It is based on KDE Neon Unstable.
Option 2. distrobox
It is possible to start developing KDE software using container images that are able to see inside your home folder. This can be done using distrobox and podman.
This solution is particularly useful for users on immutable distributions like Fedora Kinoite, openSUSE Kalpa or Valve's SteamOS 3
To learn how to build KDE software with distrobox, see: https://develop.kde.org/docs/getting-started/building/containers-distrobox/
Other operating systems
Kubuntu >= 24.10
The default configuration of kde-builder requires Qt version 6.7. Kubuntu 24.10 has Qt version 6.6. It is recommended that you use a Linux OS that is better supported by kde-builder.
If you are a more seasoned developer you might be able to use Kubuntu for kde-builder by installing Qt6 using the Qt online installer or by building Qt6 using kde-builder.
Alpine Linux
apk add git perl doas-sudo-shim
FreeBSD
Install the latest release of FreeBSD with KDE Plasma Desktop on your hardware computer or in a virtual machine.
Your user should be member of the "wheel" user group (e.g. this can be configured in the FreeBSD installer, when creating your user you can select additional user groups for your user). Your user should be able to use sudo:
pkg install sudo
visudo
# Uncomment the line: %wheel ALL=(ALL:ALL) ALL
Then set up kde-builder using the same procedure as when installing kde-builder on a Linux operating system. FreeBSD is currently supported by kde-builder. See https://www.youtube.com/watch?v=8MqBnb3Y9JU
OpenBSD >= 7.5
Install OpenBSD version greater than or equal to 7.5. In the installer keep the defaults, the user created by the installer is named "administrator" in this example.
# Enable doas
su -
cp /etc/examples/doas.conf /etc/doas.conf
exit
# kde-builder needs sudo.
mkdir -p ~/.local/bin ; ln -s /usr/bin/doas ~/.local/bin/sudo
echo "export PATH=~/.local/bin:\$PATH" >> ~/.bashrc
# Test doas.
doas su
# kde-builder needs bash.
pkg_add bash
chsh -s /usr/local/bin/bash
exit
# As user administrator
chsh -s /usr/local/bin/bash
# As per https://rsadowski.de/posts/2024-01-09-openbsd-kde/ , https://openports.pl/path/meta/kde,-plasma
doas su
pkg_add kde-plasma kate
# I recommend that you use tigervnc. https://nmariusp.github.io/install-os.html#openbsd--75
After you install kde-builder:
# Edit the kdesrc-buildrc file e.g.:
cmake-options -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKF_IGNORE_PLATFORM_CHECK=ON
# Also set environment variable:
export CMAKE_PREFIX_PATH=/usr/local/lib/qt6/cmake
# Or
export CMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake
Microsoft Windows
You can build and develop KDE projects using the Microsoft Windows operating system.
Apple macOS
You can build and develop KDE projects using the Apple macOS operating system.
What to do if CMake configure fails because a build dependency is missing
See https://community.kde.org/Get_Involved/development/Install_the_dependencies .
Project Documentation
kf6-qt6 vs. kf5-qt5
Many KDE git repositories can build correctly and run correctly using "kde-builder kf6-qt6".
The KDE git repositories that can build correctly and run correctly using "kde-builder kf6-qt6" have two long lived git branches:
- A long lived git branch that does not contain the deprecated symbols from kf5-qt5, named e.g. "master".
- And another long lived git branch for qt5-kf5, where the deprecated symbols still exist.
What is "kf6-qt6"? You just set up kde-builder following the procedure. The resulting kde-builder installation will be of type kf6-qt6. In kdesrc-buildrc in the "global" section you will have "branch-group kf6-qt6". The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch, will use the git branch where the deprecated symbols do not exist e.g. named "master".
What is "kf5-qt5"? Follow the chapter "kde-builder Qt5". The resulting kde-builder installation will be of type kf5-qt5. In kdesrc-buildrc in the "global" section you will have "branch-group kf5-qt5". The git repositories that have only one long lived git branch e.g. named "master" will use that. The git repositories that have a second long lived git branch where the deprecated symbols still exist e.g. named "kf5" will use that.
Build Qt using kde-builder
Qt6
If you cannot build the KDE frameworks using kde-builder
and the Qt provided by your Linux distribution is outdated, you might want to build the Qt framework using kde-builder
.
In your configuration file use the qt-install-dir
option (in the global section) with non-empty value, for example:
global
qt-install-dir ~/kde/usr
branch-group kf6-qt6
end global
It is recommended that if you build Qt6 using kde-builder, you also build qtwebengine. Edit the file ~/.local/state/sysadmin-repo-metadata/module-definitions/qt6.ksb
. Follow the instructions found in the file: if you want qtwebengine, add it to use-modules after "qtwebchannel" and comment out the line "ignore-modules qtwebengine".
kde-builder qtbase --refresh-build --debug
Press Ctrl+C after the CMake configure summary for qtbase. Make sure that you have the needed dependencies. Should find libb2-dev, libproxy-dev, libmd4c-dev, libmd4c-html0-dev, libxcb-xinput-dev, libatspi2.0-dev, libsqlite3-dev, unixodbc-dev, libmysqlclient-dev, postgresql-client, libecpg-dev, libpq-dev. Optional dependencies libsctp-dev, libts-dev.
kde-builder qtwebengine
This will build the Qt6 modules from qtbase up to qtwebengine. qtwebengine will probably be built incorrectly because some needed dependencies are missing.
kde-builder qtwebengine --refresh-build --debug
Press Ctrl+C after the CMake configure summary for qtwebengine. Make sure that you have the needed dependencies. Should find node.js >= 14, libdbus-1-dev, libxcomposite-dev, libxshmfence-dev, libxdamage-dev, libharfbuzz-dev, libvpx-dev, libpci-dev, libevent-dev, libre2-dev, libsnappy-dev, libcups2-dev, libxkbfile-dev.
Then build Qt6:
kde-builder qt6-set
To compile Qt6 with Qt X11 Extras (which is a necessary library to compile KWindowSystem), you should enable XCB feature during compilation
kde-builder qt6-set --cmake-options="-DQT_FEATURE_xcb=ON"
Qt5
If you want the same for Qt5, change branch-group
option and use qt5-set
instead of qt6-set
.
Qt 6 installed using the Qt online installer
A screen recording version is available https://www.youtube.com/watch?v=3BIbYN2vIZw
The homepage of the Qt Framework is https://www.qt.io . Go to this web page, create an online account. https://www.qt.io/download-open-source > "Download the Qt Online Installer" > Linux > "Qt Online Installer for Linux (64-bit)" > download a file named e.g. qt-unified-linux-x64-4.6.1-online.run into the directory e.g. "~/Downloads".
ls -la ~/Downloads # The downloaded file needs to have the "executable" chmod bit set.
chmod u+x ~/Downloads/qt-unified-linux-x64-4.6.1-online.run
~/Downloads/qt-unified-linux-x64-4.6.1-online.run
A graphical user interface (GUI) installer wizard starts. Login using your Qt online account. Next > check the checkbox "I have read and agree to the terms and conditions of using OpenSource Qt", check the checkbox "I'm an individual and do not use Qt for any company" > Next > Next > enable "Help us improve" > Next > Custom installation, notice that the install directory is "~/Qt" > Next. Install the latest version of Qt6 and the latest version of the Qt Creator integrated development environment (IDE). There are some Qt6 components that are not used by KDE and can be left out when installing Qt6 e.g. Qt Design Studio, WebAssembly, Android, Sources, Qt Quick 3D, Qt 3D, Qt Quick 3D Physics, "Qt Debug Information Files". Next > enable "I have read and agree" > Next > Install.
In the KDE Plasma app launcher (start menu) you now have the application "Qt Maintenance Tool".
Set up kde-builder from scratch as usual.
Edit the file kdesrc-buildrc to look like:
global
...
qt-install-dir ~/Qt/6.7.0/gcc_64 # Where to install Qt6 if kdesrc-build supplies it
libname lib
...
end global
Two independent kde-builder configurations: kf6-qt6 and kf5-qt5
You can switch between configurations with --rc-file
command line option. Generate another config, make the changes for the source-dir
, build-dir
, install-dir
,
and other changes you want. Make sure you use different value for persistent-data-file
option, to not mix things up.
As an alternative, you can utilize custom variable to make switch from a single config:
global
_ver 5 # <-- Change this to switch
source-dir ~/kde${_ver}/src
build-dir ~/kde${_ver}/build
install-dir ~/kde${_ver}/usr
persistent-data-file ~/kde${_ver}/persistent-options.json
end global
include ~/.local/share/kdesrc-build/data/build-include/kf${_ver}-qt${_ver}.ksb
Other CPU architectures than x86_64/amd64 and x86
You can build and develop KDE projects using a Linux OS installed on an ARM architecture CPU.
kde-builder issues
"kde-builder kpat" fails because of black-hole-solitaire
This happens on Debian/Ubuntu/Kubuntu. Because there is no Linux distribution binary package for https://github.com/shlomif/black-hole-solitaire.
Solution: append at the end of kdesrc-buildrc file:
options kpat
cmake-options -DWITH_BH_SOLVER=OFF
end options
libdisplay-info is not available
If your Linux OS does not have a package for libdisplay-info.
Append at the end of the file kdesrc-buildrc
:
module libdisplay-info
repository https://gitlab.freedesktop.org/emersion/libdisplay-info.git
end module