Jump to content

Get Involved/development/Build software with kdesrc-build: Difference between revisions

From KDE Community Wiki
m Updating run command from kdesrc to kde-builder
Broulik (talk | contribs)
Revert to kdesrc-build. kde-builder isn't ready for prime time and drives off potential contributors. It's also not blessed "the default" tool by any stretch.
Tag: Manual revert
Line 1: Line 1:
On this page, you can learn how to use KDE's {{ic|kde-builder}} tool to build various types of KDE software once you have a [[Get_Involved/development/Set_up_a_development_environment|development environment set up]].
On this page, you can learn how to use KDE's <code>kdesrc-build</code> tool to build various types of KDE software once you have a [[Get_Involved/development/Set_up_a_development_environment|development environment set up]].


It can take an hour or more to compile a KDE application, Framework, or Plasma itself for the first time. The reason for this is that {{ic|kde-builder}} by default has the option "--include-dependencies" enabled, so it will ignore all KDE packages that were installed using the distribution's package manager and will instead build from source all KDE modules that are dependencies of the module you told it to build. The next time you want to compile that or any other piece of KDE software, it will be much faster since most of the dependencies will have already been compiled.
It can take an hour or more to compile a KDE application, Framework, or Plasma itself for the first time. The reason for this is that <code>kdesrc-build</code> by default has the option "--include-dependencies" enabled, so it will ignore all KDE packages that were installed using the distribution's package manager and will instead build from source all KDE modules that are dependencies of the module you told it to build. The next time you want to compile that or any other piece of KDE software, it will be much faster since most of the dependencies will have already been compiled.
 
If you don't want to build all dependencies (e.g., because you are using a rolling release distro that provides recent versions of software), edit the same configuration file and simply set <code>include-dependencies</code> to '''false''' or add the <code>--no-include-dependencies</code> option when running <code>kdesrc-build</code>.


If you don't want to build all dependencies (e.g., because you are using a rolling release distro that provides recent versions of software), edit the same configuration file and simply set <code>include-dependencies</code> to '''false''' or add the <code>--no-include-dependencies</code> option when running {{ic|kde-builder}}.


== Frameworks ==
== Frameworks ==
'''[[Frameworks|KDE Frameworks]]''' are libraries of tools and features that can be used by any application or Plasma itself. New versions of KDE Frameworks are [[Schedules|released once a month]]. A list of all of the frameworks can be found here: https://api.kde.org/frameworks.
'''[[Frameworks|KDE Frameworks]]''' are libraries of tools and features that can be used by any application or Plasma itself. New versions of KDE Frameworks are [[Schedules|released once a month]]. A list of all of the frameworks can be found here: https://api.kde.org/frameworks.


There is no reason to build any of the frameworks manually unless you are working on code changes to changes to a specific one.
There is no reason to build any of the frameworks manually unless you are working on code changes to changes to a specific one.


When you tell kde-builder to build a module, kde-builder will automatically git clone, configure, build and install the KDE Frameworks that are required by that module.
When you tell kdesrc-build to build a module, kdesrc-build will automatically git clone, configure, build and install the KDE Frameworks that are required by that module.


== Applications ==
== Applications ==
Line 19: Line 19:
The general steps required to build and run an application are described in the following using KCalc as an example:
The general steps required to build and run an application are described in the following using KCalc as an example:


{{bc|
{{Input|1=<nowiki>
kde-builder kcalc
kdesrc-build kcalc
}}
</nowiki>}}


This command clones the KDE git repository https://invent.kde.org/utilities/kcalc in the directory <code>~/kde/src/kcalc</code>, builds all of KCalc's KDE dependencies, and then builds KCalc itself, into the directory <code>~/kde/build/kcalc</code>. If the build is successful, the result is installed into <code>~/kde/usr</code>. As a result, '''there is no need to manually install anything;''' {{ic|kde-builder}} installed it for you!   
This command clones the KDE git repository https://invent.kde.org/utilities/kcalc in the directory <code>~/kde/src/kcalc</code>, builds all of KCalc's KDE dependencies, and then builds KCalc itself, into the directory <code>~/kde/build/kcalc</code>. If the build is successful, the result is installed into <code>~/kde/usr</code>. As a result, '''there is no need to manually install anything;''' <code>kdesrc-build</code> installed it for you!   


To run it, use the <code>kde-builder --run kcalc</code> command, which launches the built-from-source version instead of the one installed by your system's package manager.
To run it, use the <code>kdesrc-run</code> command, which launches the built-from-source version instead of the one installed by your system's package manager.
{{Input|1=<nowiki>
{{Input|1=<nowiki>
kde-builder --run kcalc
kdesrc-run kcalc
</nowiki>}}
</nowiki>}}


Line 33: Line 33:


== Plasma ==
== Plasma ==
'''[[Plasma|KDE Plasma]]''' is the environment in which you can run apps. Plasma is responsible for providing a desktop with wallpaper, app launchers, and widgets; displaying notifications; managing wired and wireless networks; and similar operating-system level tasks. New versions of Plasma are [[Schedules|released three times a year]]. Plasma has multiple ''shells'': [https://kde.org/plasma-desktop Plasma Desktop] for desktop, laptop, and 2-in-1 computers, [https://www.plasma-mobile.org/ Plasma Mobile] for mobile phones, [https://plasma-bigscreen.org/ Plasma Bigscreen] for televisions, and so on. They all share certain common components, such as a window manager, networking stack, basic graphical components, and so on.
'''[[Plasma|KDE Plasma]]''' is the environment in which you can run apps. Plasma is responsible for providing a desktop with wallpaper, app launchers, and widgets; displaying notifications; managing wired and wireless networks; and similar operating-system level tasks. New versions of Plasma are [[Schedules|released three times a year]]. Plasma has multiple ''shells'': [https://kde.org/plasma-desktop Plasma Desktop] for desktop, laptop, and 2-in-1 computers, [https://www.plasma-mobile.org/ Plasma Mobile] for mobile phones, [https://plasma-bigscreen.org/ Plasma Bigscreen] for televisions, and so on. They all share certain common components, such as a window manager, networking stack, basic graphical components, and so on.


=== Plasma Desktop ===
=== Plasma Desktop ===
To build the Plasma Desktop environment and its related apps, run the following command:
To build the Plasma Desktop environment and its related apps, run the following command:
{{bc|
{{Input|1=<nowiki>
kde-builder workspace
kdesrc-build workspace
}}
</nowiki>}}


Now it's time to make your built-from-source Plasma session accessible from the SDDM login screen. We will also copy the built-from-source DBus files into a location where they are visible to the system bus. To do this, run the following command:
Now it's time to make your built-from-source Plasma session accessible from the SDDM login screen. We will also copy the built-from-source DBus files into a location where they are visible to the system bus. To do this, run the following command:
Line 61: Line 59:


=== Plasma Mobile ===
=== Plasma Mobile ===
To build the Plasma Mobile environment, run the following command:
To build the Plasma Mobile environment, run the following command:
 
{{Input|1=<nowiki>
{{bc|
kdesrc-build mobile
kde-builder mobile
</nowiki>}}
}}


You can run your custom-built Plasma Mobile in an emulated phone session using a phone-sized window within your existing desktop. Note that you probably want that this emulated phone session does not use the settings of your current user. E.g. you want in the emulated phone session to use Angelfish, not Mozilla Firefox as your web browser. Instructions:
You can run your custom-built Plasma Mobile in an emulated phone session using a phone-sized window within your existing desktop. Note that you probably want that this emulated phone session does not use the settings of your current user. E.g. you want in the emulated phone session to use Angelfish, not Mozilla Firefox as your web browser. Instructions:
Line 97: Line 93:
Plasma Mobile can also be run on a mobile device itself. For more information, see the [[Plasma/Mobile/DevGuide#Mobile_device_running_plasma_mobile|DevGuide]].
Plasma Mobile can also be run on a mobile device itself. For more information, see the [[Plasma/Mobile/DevGuide#Mobile_device_running_plasma_mobile|DevGuide]].


== How to solve kde-builder problems ==
== How to solve kdesrc-build problems ==
 
Did one or more modules fail to build (displayed in red font) using <code>kdesrc-build</code>? Then here's what to do:
Did one or more modules fail to build (displayed in red font) using {{ic|kde-builder}}? Then here's what to do:


# Try building the failing module again from scratch using {{ic|kde-builder [failing module] --refresh-build}}
# Try building the failing module again from scratch using <code>kdesrc-build [failing module] --refresh-build</code>
# Make sure that you have all the dependencies for the failing module. Open the log file for the failing module which {{ic|kde-builder}} will print the path at the end of its output. Scroll to the bottom of the log file and read the output to see what missing dependency it is complaining about. Then find and install the corresponding package using the package manager of your distribution. If several look relevant, install them all just to be safe. When you have the necessary dependencies, you can save time and resume from the failing module by adding <code>--resume-from [the name of the module that failed]</code> to your {{ic|kde-builder}} command.
# Make sure that you have all the dependencies for the failing module. Open the log file for the failing module which <code>kdesrc-build</code> will print the path at the end of its output. Scroll to the bottom of the log file and read the output to see what missing dependency it is complaining about. Then find and install the corresponding package using the package manager of your distribution. If several look relevant, install them all just to be safe. When you have the necessary dependencies, you can save time and resume from the failing module by adding <code>--resume-from [the name of the module that failed]</code> to your <code>kdesrc-build</code> command.
# Look at the KDE project's https://invent.kde.org GitLab project. If the project has a GitLab build pipeline and if the pipeline is broken, then it's not your fault. :)
# Look at the KDE project's https://invent.kde.org GitLab project. If the project has a GitLab build pipeline and if the pipeline is broken, then it's not your fault. :)
# Ask for help in the the [https://webchat.kde.org/#/room/#kde-devel:kde.org #kde-devel] channel on [[Matrix]] or Libera Chat [[Internet Relay Chat | IRC]]. See [[Get Involved/development#Where_to_find_the_development_team]]
# Ask for help in the the [https://webchat.kde.org/#/room/#kde-devel:kde.org #kde-devel] channel on [[Matrix]] or Libera Chat [[Internet Relay Chat | IRC]]. See [[Get Involved/development#Where_to_find_the_development_team]]
# Looking into the error log is also helpful. For example, the build stopped at kwallet. You will need to go into <code>kde/src/log/latest/kwallet/error.log</code> and find what packages are missing.
# Looking into the error log is also helpful. For example, the build stopped at kwallet. You will need to go into <code>kde/src/log/latest/kwallet/error.log</code> and find what packages are missing.
# If you know what files are missing, but you don't know what packages provide them, you can ask your package manager. See https://wiki.archlinux.org/index.php/Pacman/Rosetta (see "Query the package which provides FILE").
# If you know what files are missing, but you don't know what packages provide them, you can ask your package manager. See https://wiki.archlinux.org/index.php/Pacman/Rosetta (see "Query the package which provides FILE").
# The problem might be in <code>~/kde/usr</code>. E.g. a file in <code>~/kde/usr/include</code> which was renamed or moved. You can help yourself by seeing if you can reproduce this issue in a clean new Virtual Machine (VM). If you cannot reproduce the issue in your VM, then a possible solution is to start with a new and clean kde-builder installation. I.e. run something like <code>mv ~/.config/kdesrc-buildrc ~/.config/kdesrc-buildrc~bak ; mv ~/kde ~/kde~bak</code>.
# The problem might be in <code>~/kde/usr</code>. E.g. a file in <code>~/kde/usr/include</code> which was renamed or moved. You can help yourself by seeing if you can reproduce this issue in a clean new Virtual Machine (VM). If you cannot reproduce the issue in your VM, then a possible solution is to start with a new and clean kdesrc-build installation. I.e. run something like <code>mv ~/.config/kdesrc-buildrc ~/.config/kdesrc-buildrc~bak ; mv ~/kde ~/kde~bak</code>. Then install kdesrc-build from scratch.
# More ideas about how to fix kde-builder issues are available here: [[Get_Involved/development/Install_the_dependencies]] and [[Get_Involved/development/More]].
# More ideas about how to fix kdesrc-build issues are available here: [[Get_Involved/development/Install_the_dependencies]] and [[Get_Involved/development/More]].


== Iterating on a single project ==
== Iterating on a single project ==
 
When you're working on a project and you want to rebuild it to test your changes, you can save a lot of time by only rebuilding that project, rather than the entire stack. For example if you are working on <code>plasma-desktop</code>, you can rebuild only that project rather than everything by running <code>kdesrc-build --no-src --no-include-dependencies plasma-desktop</code>.
When you're working on a project and you want to rebuild it to test your changes, you can save a lot of time by only rebuilding that project, rather than the entire stack. For example if you are working on <code>plasma-desktop</code>, you can rebuild only that project rather than everything by running {{ic|kde-builder --no-src --no-include-dependencies plasma-desktop}}.


== How to run an application after making changes to one of its dependencies ==
== How to run an application after making changes to one of its dependencies ==
Build the application that you want to build, e.g. KCalc:
Build the application that you want to build, e.g. KCalc:
 
{{Input|1=<nowiki>
{{bc|
kdesrc-build kcalc
kde-builder kcalc
</nowiki>}}
}}


This command builds not only KCalc, but all of the KDE git repositories on which it depends, such as the KDE Frameworks library KConfig.
This command builds not only KCalc, but all of the KDE git repositories on which it depends, such as the KDE Frameworks library KConfig.


Now let's say you want to make a change to KConfig that should change a behavior in KCalc. In this case, you don't want kde-builder to discard your changes to KConfig. So first build KConfig separately, on its own, without doing a source code update:
Now let's say you want to make a change to KConfig that should change a behavior in KCalc. In this case, you don't want kdesrc-build to discard your changes to KConfig. So first build KConfig separately, on its own, without doing a source code update:
 
{{Input|1=<nowiki>
{{bc|
kdesrc-build kconfig --no-src --no-include-dependencies --refresh-build --debug
kde-builder kconfig --no-src --no-include-dependencies --refresh-build --debug
</nowiki>}}
}}


This will build just KConfig and install the needed build products into <code>~/kde/usr</code>. Now we want to run KCalc in such a way that it makes use of those changed files. Do it like so:
This will build just KConfig and install the needed build products into <code>~/kde/usr</code>. Now we want to run KCalc in such a way that it makes use of those changed files. Do it like so:


{{bc|
{{Input|1=<nowiki>
kde-builder kcalc --no-src --no-include-dependencies --refresh-build --debug
kdesrc-build kcalc --no-src --no-include-dependencies --refresh-build --debug
kdesrc-run kcalc
kdesrc-run kcalc
}}
</nowiki>}}


== Tips and Tricks ==
== Tips and Tricks ==
Line 147: Line 138:
Alternatively, you can create a wrapper script to strip out the ansi code characters.
Alternatively, you can create a wrapper script to strip out the ansi code characters.


{{hbc-hl|lang=bash|head=kde-builder-and-striplog|code=<nowiki>
{{hbc-hl|lang=bash|head=kdesrc-build-and-striplog|code=<nowiki>
cd ~/kde
cd ~/kde
./kde-builder $@
./kdesrc-build $@
sed -i $'s/\033[[][^A-Za-z]*[A-Za-z]//g' ~/kde/src/log/latest/"$1"/build.log
sed -i $'s/\033[[][^A-Za-z]*[A-Za-z]//g' ~/kde/src/log/latest/"$1"/build.log
</nowiki>}}
</nowiki>}}
 
It will strip the log for first module built with kdesrc-build.
It will strip the log for first module built with kde-builder.


=== Prevent from accidental src folder deletion ===
=== Prevent from accidental src folder deletion ===
Line 162: Line 152:


== Next Steps ==
== Next Steps ==
Now you can compile anything in KDE from its source code! Time to think about what to do with this superpower...
Now you can compile anything in KDE from its source code! Time to think about what to do with this superpower...


Line 171: Line 160:
{{CenteredButton|text=Submit your new software changes for review|link=Infrastructure/GitLab#Submitting_a_merge_request}}
{{CenteredButton|text=Submit your new software changes for review|link=Infrastructure/GitLab#Submitting_a_merge_request}}


Or perhaps you'd like to further adapt kde-builder to your needs like managing different builds on the same machine or setting up your preferred IDE. If that's what you need, you can visit the advanced section.
Or perhaps you'd like to further adapt kdesrc-build to your needs like managing different builds on the same machine or setting up your preferred IDE. If that's what you need, you can visit the advanced section.


{{CenteredButton|text=Advanced kde-builder features and troubleshooting|link=Get_Involved/development/More}}
{{CenteredButton|text=Advanced kdesrc-build features and troubleshooting|link=Get_Involved/development/More}}

Revision as of 08:51, 6 March 2024

On this page, you can learn how to use KDE's kdesrc-build tool to build various types of KDE software once you have a development environment set up.

It can take an hour or more to compile a KDE application, Framework, or Plasma itself for the first time. The reason for this is that kdesrc-build by default has the option "--include-dependencies" enabled, so it will ignore all KDE packages that were installed using the distribution's package manager and will instead build from source all KDE modules that are dependencies of the module you told it to build. The next time you want to compile that or any other piece of KDE software, it will be much faster since most of the dependencies will have already been compiled.

If you don't want to build all dependencies (e.g., because you are using a rolling release distro that provides recent versions of software), edit the same configuration file and simply set include-dependencies to false or add the --no-include-dependencies option when running kdesrc-build.


Frameworks

KDE Frameworks are libraries of tools and features that can be used by any application or Plasma itself. New versions of KDE Frameworks are released once a month. A list of all of the frameworks can be found here: https://api.kde.org/frameworks.

There is no reason to build any of the frameworks manually unless you are working on code changes to changes to a specific one.

When you tell kdesrc-build to build a module, kdesrc-build will automatically git clone, configure, build and install the KDE Frameworks that are required by that module.

Applications

KDE Applications like Calculator (KCalc), Dolphin, Okular, Konsole and Gwenview are standalone apps that can be run on multiple platforms, such as Plasma, GNOME, even macOS and Windows! New versions of KDE Applications are released three times a year. Note that the Discover app store (git repo name: plasma-discover) and System Settings app (git repo name: systemsettings) are distributed alongside Plasma, but they build like apps using the below instructions. A list of all KDE applications can be found here: https://apps.kde.org/.

The general steps required to build and run an application are described in the following using KCalc as an example:

kdesrc-build kcalc

This command clones the KDE git repository https://invent.kde.org/utilities/kcalc in the directory ~/kde/src/kcalc, builds all of KCalc's KDE dependencies, and then builds KCalc itself, into the directory ~/kde/build/kcalc. If the build is successful, the result is installed into ~/kde/usr. As a result, there is no need to manually install anything; kdesrc-build installed it for you!

To run it, use the kdesrc-run command, which launches the built-from-source version instead of the one installed by your system's package manager.

kdesrc-run kcalc

Did it run? If so, then congratulations, you just compiled your own version of KCalc from source code!

Plasma

KDE Plasma is the environment in which you can run apps. Plasma is responsible for providing a desktop with wallpaper, app launchers, and widgets; displaying notifications; managing wired and wireless networks; and similar operating-system level tasks. New versions of Plasma are released three times a year. Plasma has multiple shells: Plasma Desktop for desktop, laptop, and 2-in-1 computers, Plasma Mobile for mobile phones, Plasma Bigscreen for televisions, and so on. They all share certain common components, such as a window manager, networking stack, basic graphical components, and so on.

Plasma Desktop

To build the Plasma Desktop environment and its related apps, run the following command:

kdesrc-build workspace

Now it's time to make your built-from-source Plasma session accessible from the SDDM login screen. We will also copy the built-from-source DBus files into a location where they are visible to the system bus. To do this, run the following command:

~/kde/build/plasma-workspace/login-sessions/install-sessions.sh

Note

SELinux can interfere with the new DBus services working correctly, and the path of least resistance may be to simply turn off enforcement if you are using a distro that ships with it on by default (for example, Fedora). To do this, set the value of SELINUX to permissive in the file /etc/selinux.


After this, you can log out and select your new plasma session in SDDM's session chooser menu (which is located in the bottom-left corner of the screen if you're using the Breeze SDDM theme).

Alternatively, you can run the new version of plasma on top of your existing system for quick testing like so:

source ~/kde/build/plasma-desktop/prefix.sh
~/kde/usr/bin/plasmashell --replace

Take note of known issues with built-from-source dev sessions.

Plasma Mobile

To build the Plasma Mobile environment, run the following command:

kdesrc-build mobile

You can run your custom-built Plasma Mobile in an emulated phone session using a phone-sized window within your existing desktop. Note that you probably want that this emulated phone session does not use the settings of your current user. E.g. you want in the emulated phone session to use Angelfish, not Mozilla Firefox as your web browser. Instructions:

export XDG_RUNTIME_DIR=/tmp/
export QT_QPA_PLATFORM=wayland
export QT_QPA_PLATFORMTHEME=KDE
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export XDG_CURRENT_DESKTOP=KDE
export KSCREEN_BACKEND=QScreen
export KDE_FULL_SESSION=1
export KDE_SESSION_VERSION=5
export QT_QUICK_CONTROLS_MOBILE=1
export PLASMA_PLATFORM=phone:handheld
export $(dbus-launch)
dbus-run-session kwin_wayland --width 360 --height 720 --xwayland "plasmashell -p org.kde.plasma.mobileshell"

Alternative instructions for starting an emulated phone session.

export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export QT_QUICK_CONTROLS_MOBILE=1
export PLASMA_PLATFORM=phone:handheld

QT_QPA_PLATFORM=wayland dbus-run-session kwin_wayland --xwayland "plasmashell -p org.kde.plasma.mobileshell" --width 360 --height 720

Plasma Mobile can also be run on a mobile device itself. For more information, see the DevGuide.

How to solve kdesrc-build problems

Did one or more modules fail to build (displayed in red font) using kdesrc-build? Then here's what to do:

  1. Try building the failing module again from scratch using kdesrc-build [failing module] --refresh-build
  2. Make sure that you have all the dependencies for the failing module. Open the log file for the failing module which kdesrc-build will print the path at the end of its output. Scroll to the bottom of the log file and read the output to see what missing dependency it is complaining about. Then find and install the corresponding package using the package manager of your distribution. If several look relevant, install them all just to be safe. When you have the necessary dependencies, you can save time and resume from the failing module by adding --resume-from [the name of the module that failed] to your kdesrc-build command.
  3. Look at the KDE project's https://invent.kde.org GitLab project. If the project has a GitLab build pipeline and if the pipeline is broken, then it's not your fault. :)
  4. Ask for help in the the #kde-devel channel on Matrix or Libera Chat IRC. See Get Involved/development#Where_to_find_the_development_team
  5. Looking into the error log is also helpful. For example, the build stopped at kwallet. You will need to go into kde/src/log/latest/kwallet/error.log and find what packages are missing.
  6. If you know what files are missing, but you don't know what packages provide them, you can ask your package manager. See https://wiki.archlinux.org/index.php/Pacman/Rosetta (see "Query the package which provides FILE").
  7. The problem might be in ~/kde/usr. E.g. a file in ~/kde/usr/include which was renamed or moved. You can help yourself by seeing if you can reproduce this issue in a clean new Virtual Machine (VM). If you cannot reproduce the issue in your VM, then a possible solution is to start with a new and clean kdesrc-build installation. I.e. run something like mv ~/.config/kdesrc-buildrc ~/.config/kdesrc-buildrc~bak ; mv ~/kde ~/kde~bak. Then install kdesrc-build from scratch.
  8. More ideas about how to fix kdesrc-build issues are available here: Get_Involved/development/Install_the_dependencies and Get_Involved/development/More.

Iterating on a single project

When you're working on a project and you want to rebuild it to test your changes, you can save a lot of time by only rebuilding that project, rather than the entire stack. For example if you are working on plasma-desktop, you can rebuild only that project rather than everything by running kdesrc-build --no-src --no-include-dependencies plasma-desktop.

How to run an application after making changes to one of its dependencies

Build the application that you want to build, e.g. KCalc:

kdesrc-build kcalc

This command builds not only KCalc, but all of the KDE git repositories on which it depends, such as the KDE Frameworks library KConfig.

Now let's say you want to make a change to KConfig that should change a behavior in KCalc. In this case, you don't want kdesrc-build to discard your changes to KConfig. So first build KConfig separately, on its own, without doing a source code update:

kdesrc-build kconfig --no-src --no-include-dependencies --refresh-build --debug

This will build just KConfig and install the needed build products into ~/kde/usr. Now we want to run KCalc in such a way that it makes use of those changed files. Do it like so:

kdesrc-build kcalc --no-src --no-include-dependencies --refresh-build --debug
kdesrc-run kcalc

Tips and Tricks

Viewing colored build logs

Currently, the log file include escape symbols (that are used to color the text, or format it as bold for example). To be able to view it as expected, you can use a sublime with the ANSI color plugin. Alternatively, you can open logs with cat in konsole when clicking. Because the file extension is ".log", it is not recognized as a text file, so the option to change text editor command is not applied. Instead, open the System Settings | File Associations, search for "text/x-log" mime type. Press Add to add a new association and select Konsole. Now edit the application's arguments with this text: --hold -e /usr/bin/cat %U.

Now when you will Ctrl + click on the text like file:///home/username/kde6/src/log/2023-12-31-01/ark/build.log, the new konsole window will appear, with text formatted. As a bonus, you get a clickable lines that say in which line error occured.

Alternatively, you can create a wrapper script to strip out the ansi code characters.

kdesrc-build-and-striplog
cd ~/kde
./kdesrc-build $@
sed -i $'s/\033[[][^A-Za-z]*[A-Za-z]//g' ~/kde/src/log/latest/"$1"/build.log

It will strip the log for first module built with kdesrc-build.

Prevent from accidental src folder deletion

When you want to start the whole build from scratch, by deleting your ~/kde/build and ~/kde/usr, you may accidentally delete your ~/kde/src. To protect yourself from that, you can set immutable flag to that directory. sudo chattr +i ~/kde/src.

Now you have write permission to the folder, but you cannot delete the folder.

Next Steps

Now you can compile anything in KDE from its source code! Time to think about what to do with this superpower...

If you already know what you want to work on and you are in fact already working on it, then it might be time to start making a merge request and sending your changes.

Or perhaps you'd like to further adapt kdesrc-build to your needs like managing different builds on the same machine or setting up your preferred IDE. If that's what you need, you can visit the advanced section.