Introduction
I have been using KDE for quite some time and recently decided to start contributing to KDE development. However, I hit a few problems in the way before deciding to create a CLI tool.
Toolbox
I use Fedora as my daily driver. Toolbox is built on top of Podman. It is mainly designed for use with immutable OS like Fedora Silverblue but can be used with other distributions. I use toolbox for most of my development, so I started setting up the development environment in it as outlined here.
However, when I tried building Solid using kdesrc-build, I started getting many errors about Undefined Reference everywhere. I tried installing pretty much the whole plasma inside the toolbox but couldn't fix the problem. I also opened a bug report but no luck. So I kind of left there to get some fresh air.
Docker
This was my second attempt to set up a development environment. KDE provides a guide to set up a docker container for development here.
It seemed a little old since it used nvidia-docker instead of nvidia-container-toolkit. There were a few problems though:
- Docker didn't work well when I installed it.
- Neither nvidia-docker nor nvidia-container-toolkit are not officially supported in Fedora
I didn't try too hard to fix docker in my system since I use Fedora Silverblue on my laptop, and I don't want to install docker on it. So I moved on to podman.
Podman
At first, I thought I could just modify the build scripts a little to work with Podman. I was partially correct since to get the container started, I just replaced the docker command with podman.
However, getting Nvidia to work was much more complicated. Now, I am not a container expert, so a lot of it was because of my unfamiliarity with the technology. At first, I had to get nvidia-container-toolkit using CentOS package. The test containers given in the instructions here worked fine. However, I soon understood that nvidia-container-toolkit requires basing the image on nvidia official containers or going through this and figure out how to create a custom container. Most documentation online seemed to be about nvidia-docker or just covered the install portion of nvidia-container-toolkit. There was almost nothing available on how to create a custom image. After some digging around and copying and pasting (I still don't understand some of it), I was able to create a container with nvidia-smi, and other cuda commands working.
At this point, the modification to the collection of scripts was getting a little bigger. So I decided to create a CLI tool to combine everything.
KDE Container CLI
I started writing a cli that could create containers for me and added features like launching GUI apps inside the container without entering. It supports both podman and docker, but the docker side isn't tested since I don't use docker much.
Usage
It uses a structure of subcommands to work. We have four commands at the top level:
- Build: To build the container image for development.
- Run: To run/start/attach to the container.
- Config: For storing extra configuration that might be required in some systems. E.g., Podman requires adding to xhost to display GUI applications.
- Launch: To launch GUI applications like Kdevelop without entering the container.
All commands other than Config have a subcommand to choose between docker and podman.
Problems
- Nvidia still doesn't work perfectly. GUI applications like glxgear and qtcreator can't seem to find graphic drivers even though CLI applications work.
- Docker part isn't tested.
Conclusion
My current setup for KDE development is working quite well. The CLI tool is hosted here. I hope to finally start some work with KDE development now that everything seems to be working.
Contributions are, of course, welcome from everyone in the form of issues or code. It would be great if someone could fix the nvidia part of the CLI.
Currently, the binary is distributed as a tar.gz file with the dockerfiles and other assets required.
Top comments (0)