Gentoo musl Support Expansion for Qt/KDE Week 2

Hello!
This is my second weekly report for my Google Summer of Code project regarding musl support expansion.
My work this week has been pretty similar to the first, ie. I’ve mostly fixed build time bugs caused by GNU extensions. But I’ve also came across and fixed some runtime bugs here as well. I have successfully finished all work I stated in my proposal for the first 2 weeks, that being getting a lot of Qt/KDE libraries installed. I have also worked on a lot of other things used on a typical KDE Plasma desktop.

To start with I investigated Baloo, a file indexing service for KDE. This process crashed for me on both my testing setups, but after wiping my search cache the issue went away and I haven’t been able to recreate it since :/. A similar issue which I thought at first was related, was kioslave5 crashing when searching for files with Dolphin. After searching online I found out that it had already been solved upstream.
Another run time issue I wound was that lvm2 was crashing on launch. After compiling with debugsyms and opening it in gdb I found out that this line [1] caused it. From last week I knew that the standard streams in musl are read only and my thought was that replacing the assignment with freopen would be the proper patch. This change seemed to make lvm2 run without issues but after taking this upstream they responded with saying that the code was made to limit internal glibc stream buffers and that they will look into fixing this for musl.
I have also learned a lot about using CMake. The first one was this small fix [2]. The second fix regarding CMake was this one [3]. It used a macro HAVE_LOCALE_H to determine whether locale.h was present or not. I spent a lot of time messing around with CMake to properly detect when locale.h was defined, firsly by generating a config.h via CMake that got imported by mlt_property.h, the problem here was that mlt_property.h was a header that got installed onto the system. Therefore a #include “config.h” solution did not work. A very similar solution that would’ve worked would be to create a mlt_config.h file globally generated at build time, that defined these macros. However, a much easier fix was just to remove the ifdef __GLIBC__ check and make it instead ifdef __linux__, because locale.h has been in POSIX since issue 7 and relying on it shouldn’t be an issue.
I also discovered that some Flatpaks like Chromium did not want to run on musl. This was because Bubblewrap was installed with suid permissions and packages with double sandboxes did not like that, I did not dig deeper than that but I suspect something messes up with user namespaces + suid. Flatpak has an option to use system Bubblewrap or build it’s own, and if it builds it’s own Bubblewrap it won’t have suid permissions and therefore work. I thought at first that I should add a system-bubblewrap USE-flag to sys-apps/flatpak and make it default on the musl profile. But after further reading I learned Bubblewrap now uses other methods for getting needed permissions and instead I made -suid default on sys-apps/bubblewrap. Still a little unsure if I should add a system-bubblewrap USE-flag for Flatpak as well.
During this week I’ve also gotten to write and fix some ebuilds both for my personal repo and ::gentoo. I’ve learnt how to properly set permissions with fperms, how to add USE-flags with descriptions and setting default USE-flags for profiles, ex. musl. I’ve worked with the autotools, meson and git-r3 eclasses.
This entry was posted in musl KDE. Bookmark the permalink.

Leave a Reply

Your email address will not be published.