Jump to content

Get Involved/development/More: Difference between revisions

From KDE Community Wiki
Nmariusp (talk | contribs)
Build Qt using kdesrc-build
Nmariusp (talk | contribs)
kdesrc-build, Qt6 and KDE Frameworks 6
Line 51: Line 51:
kdesrc-build frameworks
kdesrc-build frameworks
</nowiki>}}
</nowiki>}}
== kdesrc-build, Qt6 and KDE Frameworks 6 ==
Set up kdesrc-build clean from scratch following the same procedure as when using "Qt5 and KDE Frameworks 5". Before building anything using kdesrc-build, do:
{{Input|1=<nowiki>
sed -i 's/kf5-common/kf6-common/' ~/.config/kdesrc-buildrc
sed -i 's/kf5-qt5/kf6-qt6/' ~/.config/kdesrc-buildrc
</nowiki>}}
The file <code>~/.config/kdesrc-buildrc</code> should contain the not commented out lines:
{{Input|1=<nowiki>
include /home/username/kde/src/kdesrc-build/kf6-common-options-build-include
...
include /home/username/kde/src/kdesrc-build/kf6-qt6-build-include
</nowiki>}}
Then build KDE Frameworks 6:
{{Input|1=<nowiki>
kdesrc-build frameworks
</nowiki>}}
Note: <code>kdesrc-build --initial-setup</code> does not install the packages needed for building with kdesrc-build "Qt6 and KDE Frameworks 6". The instructions on [[Guidelines and HOWTOs/Build from source/Install the dependencies|how to install the dependencies]] are for "Qt5 and KDE Frameworks 5" only, they do not work for "Qt6 and KDE Frameworks 6". Therefore many kdesrc-build modules will fail to build because of missing dependencies (CMake errors).

Revision as of 22:48, 26 December 2022

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.

Develop in a Linux container

When you start programming for KDE, it is recommended that you 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.

As an alternative, you can run kdesrc-build 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

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 https://github.com/89luca89/distrobox

Start with the official Docker hub container image of one of the Linux distributions that is better suited for kdesrc-build. Then setup kdesrc-build in the container. distrobox makes it such that you can run GUI apps in the container. Also, your user's home directory (~) is the same in the host operating system and in the container. Warning: the container will write to your home directory and may conflict with your host operating system.

Other operating systems

FreeBSD

Install the latest release of FreeBSD with KDE Plasma Desktop on your hardware computer or in a virtual machine. 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

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.

Build Qt using kdesrc-build

Set up kdesrc-build from scratch as usual.

Open the configuration file ~/.config/kdesrc-buildrc and confirm that qtdir and the lines include...qt5-build-include and include...custom-qt5-libs-build-include are not commented out (i.e. there should not be a # in front of the lines). E.g. (replace "username" with your Linux user's name):

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

Run in a terminal:

kdesrc-build Qt5
kdesrc-build frameworks

kdesrc-build, Qt6 and KDE Frameworks 6

Set up kdesrc-build clean from scratch following the same procedure as when using "Qt5 and KDE Frameworks 5". Before building anything using kdesrc-build, do:

sed -i 's/kf5-common/kf6-common/' ~/.config/kdesrc-buildrc
sed -i 's/kf5-qt5/kf6-qt6/' ~/.config/kdesrc-buildrc

The file ~/.config/kdesrc-buildrc should contain the not commented out lines:

include /home/username/kde/src/kdesrc-build/kf6-common-options-build-include
...
include /home/username/kde/src/kdesrc-build/kf6-qt6-build-include

Then build KDE Frameworks 6:

kdesrc-build frameworks

Note: kdesrc-build --initial-setup does not install the packages needed for building with kdesrc-build "Qt6 and KDE Frameworks 6". The instructions on how to install the dependencies are for "Qt5 and KDE Frameworks 5" only, they do not work for "Qt6 and KDE Frameworks 6". Therefore many kdesrc-build modules will fail to build because of missing dependencies (CMake errors).