DEV Community

insidewhy
insidewhy

Posted on

Installing kde 6 (plasma 6) from source on ubuntu 24.04

Install qt 6

Install the latest qt 6.6 releases using qt online installer. Just select qt 6.6, no other packages are needed. I chose to install it to /opt/qt and created this directory with sudo mkdir /opt/qt && chown $USER /opt/qt. Then put something like /opt/qt/<qt-version>/gcc_64/bin to the head of the PATH environment variable via ~/.zshrc or ~/.bashrc (for me <qt-version> was 6.6.3, the latest 6.6 release at the time I wrote this).

Setup pkg-config

Ensure pkg-config can find the qt libraries installed above by adding /opt/qt/<qt-version>/gcc_64/lib/pkgconfig to PKG_CONFIG_PATH via your shell startup file. If you use brew then it's probably installed its own pkg-config which is now at the head of your $PATH. In this case ensure it can find the system pkgconfig files by also adding /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig to PKG_CONFIG_PATH.

Something like this should be okay:

if [ -d /home/linuxbrew ]; then export PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH fi QT6DIR=/opt/qt/6.6.3/gcc_64 if [ -d $QT6DIR/bin ]; then # for zsh: path=($QT6DIR/bin $path) # for bash: # export PATH="$QT6DIR/bin:$PATH" export PKG_CONFIG_PATH=$QT6DIR/lib/pkgconfig:$PKG_CONFIG_PATH fi 
Enter fullscreen mode Exit fullscreen mode

Install kde-builder

Follow the initial instructions here at the Generic Installation section only.

The kde-builder --install-distro-packages doesn't seem much use as:

  • The qt6 package versions it installed are out of date.
  • It doesn't install most of the required dependencies.

I did run it and then manually uninstalled the qt6 dependencies since qt6 was already installed and configured using the steps above.

Then run

kde-builder --generate-config 
Enter fullscreen mode Exit fullscreen mode

After this I edited ~/.config/kdesrc-buildrc to install to /opt/plasma6 by changing the line starting install-dir:

install-dir /opt/plasma6 
Enter fullscreen mode Exit fullscreen mode

And created this directory with:

sudo mkdir /opt/plasma6 sudo chown $USER /opt/plasma6 
Enter fullscreen mode Exit fullscreen mode

Add some unavailable python dependencies

Create a directory to store the dependencies:

sudo mkdir /opt/python sudo chown $USER /opt/python 
Enter fullscreen mode Exit fullscreen mode

Add this path to PYTHONPATH in your shell config:

if [ -d /opt/python ]; then export PYTHONPATH=/opt/python/local/lib/python$(python3 --version | grep -o '3.[0-9]*')/dist-packages fi 
Enter fullscreen mode Exit fullscreen mode

Then install them:

pip install --prefix /opt/python chai 
Enter fullscreen mode Exit fullscreen mode

Be careful that brew has not installed python otherwise you'll have something like python3 pointing to your system python and python3.12 pointing to brew's version, then the build scripts will detect brew's version and not see your system packages. I just uninstalled brew's version.

Start installing

kde-builder workspace 
Enter fullscreen mode Exit fullscreen mode

This will inevitably fail many times and give the location of a log that indicates the error, which is usually a missing package. When installing that package use one with a -dev suffix.

After installing the package run:

kde-builder --resume-from <name of package that failed> workspace 
Enter fullscreen mode Exit fullscreen mode

To resume building from where it left off.

I needed the following additional packages:

sudo apt install libxkbcommon-dev libpolkit-gobject-1-dev libpolkit-agent-1-dev libxcb-damage0-dev libyaml-dev libsystemd-dev libstemmer-dev itstool libpcap-dev libsensors-dev libxcb-dpms0-dev libpipewire-0.3-dev libxcb-xtest0-dev libpam0g-dev libeis-dev libxcvt-dev liblcms2-dev libopenjp2-7 libappimage-dev libattr1-dev libnm-dev libqrencode-dev libdmtx-dev libzxing-dev libqalculate-dev libxcursor-dev libxtst-dev libpulse-dev modemmanager-dev python3-cairo libgtk-3-dev libxxf86vm-dev wl-clipboard libaccounts-glib-dev libsdl2-dev libxkbregistry-dev xserver-xorg-input-libinput-dev xserver-xorg-input-evdev-dev xorg-dev 
Enter fullscreen mode Exit fullscreen mode

I also had to install a perl cpan module:

cpan install URI::Escape 
Enter fullscreen mode Exit fullscreen mode

This worked for me because I had perl installed via brew (I haven't used perl for over 20 years, I guess it was a dependency of a package I did use), otherwise sudo may be necessary at the risk of polluting your /usr directory with files not managed by apt

kaccounts seems to be missing from the dependency list of plasma-desktop so at some point I had to install this manually via:

kde-builder kaccounts 
Enter fullscreen mode Exit fullscreen mode

Before resuming:

kde-builder --resume-from plasma-desktop workspace 
Enter fullscreen mode Exit fullscreen mode

Create a startup script

Create the following file at /opt/plasma6/bin/start-kde6:

#!/usr/bin/env bash # replace $USER with the location of the user's home directory # who built KDE6 source $USER/.config/kde-env-master.sh if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then exec dbus-run-session startplasma-wayland else exec startplasma-wayland fi 
Enter fullscreen mode Exit fullscreen mode

Ensure it is executable:

chmod a+x /opt/plasma6/bin/start-kde6 
Enter fullscreen mode Exit fullscreen mode

Add desktop entry to sddm

Create the following file:

sudo touch /usr/share/wayland-sessions/plasmawayland6.desktop sudo chown $USER /usr/share/wayland-sessions/plasmawayland6.desktop 
Enter fullscreen mode Exit fullscreen mode

Then add the following content:

[Desktop Entry] Exec=/opt/plasma6/bin/start-kde6 DesktopNames=KDE6 Name=Plasma 6 (Wayland) Comment=Plasma 6 by KDE X-KDE-PluginInfo-Version=6.0.6 
Enter fullscreen mode Exit fullscreen mode

Start kde6

Logout of your window manager and select the plasma 6 entry from sddm and see if it starts.

For me it didn't.

I got a black screen, the mouse cursor could be moved. Using my krunner keybinding I noticed some glitches at the top of the screen where krunner would usually appear. I could switch to another virtual console via ctrl+alt+f3 to restart sddm, after this trying to start plasma6 again froze my computer and I had to reboot it. When I switched back to kde5, most of my keybindings were gone. Luckily I backed them up several kde config files before switching over and could restore them.

When I was in the virtual console and plasma6 was running, I noticed it had started /usr/bin/plasmashell instead of /opt/plasma6/bin/plasmashell. Disappointing. I verified that PATH and XDG_CONFIG_DIRS were set properly by looking at the environment of the startplasma-wayland process in the /proc filesystem, so why it's still choosing /usr/bin/plasmashell I don't know.

Some of my code is in KDE, for the notification system and scripting system. I'd love to be able to contribute again. The matrix chat for KDE is not open for registration so I'm not sure how I can get help to solve this problem.

I'm using the nvidia-drivers currently at version 550. Wayland on plasma5 is okay, but copy and paste is not reliable. Especially in slack. Sometimes it works for a while and then breaks forever. To paste into my terminal I usually need to hit paste several times for the very first paste into that terminal, after which point it works.

Top comments (1)

Collapse
 
timleg002 profile image
Timotej Leginus

Finally after a week, I managed to compile this on Pop!_OS 22.04 :))