listout 2023

As this year’s Google Summer of Code has ended, it’s time for me to summarize all my work at Gentoo Linux foundation for Google Summer of Code 2023. In a nutshell, I was able to complete most of my deliverables, while there are still open bugs in the tracker but I’ve managed to close many of them and also port MATE and GNOME for llvm profile.

Me using GNOME on LLVM profile

Overview of my work

The main focus of my project for GSoC 2023 was to work towards closing as much as bug possible from the “Modern C (C99) porting” tracker bug, along with that also to make sure at least some of the desktop environments are building proper with either llvm or musl llvm profile. So many of these bugs included fixing bugs related to improper function declaration, calling functions with improper parameters, and not inclusion of proper header files, while some were also related to build and/or configuration issues with llvm toolchain and lld (LLVM) linker.

To give an example, very often I would come across packages which gave build errors such as “incompatible function pointer types” or “call to undeclared function“. All of these were either invalid in C99, invalid even in C89, or extremely dubious. Compilers just tolerated them as quasi-extensions for a while (until now) to avoid disruption. But with newer compilers such as Clang 16 and GCC 14 turns on some of these errors by default which results in such build failures.

For most of them the fix was to go into to the source code find the source files that had the error/mistake and fix them, then recompile to check whether my changes fixed them. If the errors were *correctly* patched then make a diff/patch file that could be applied via the ebuild, the ebuild would most of the time require a revision bump along with the patch.

Most of the time I tried to send my patches upstream while keeping a note int the GitHub PR so that Sam and Jonas would be able to track my progress know when I’m able to send my patches upstream or if I had any issues doing so (some times it was confusing for me to find upstream, as they didn’t have a GitHub repo/mirror and would operate via mailing list)

What I learned from GSoC 2023 Project

  • First and foremost I learned the how older C compilers worked and different are they from the newer generation of compilers, especially Clang 16 and GCC 13 and 14. Like how sometimes the older ones allowed bad code/coding habits and compilers just allowed them to avoid disruption.
  • Secondly I learned a lot of various C standards (for example C89, C99, C11 and very recent C23).
  • Next I came across the various compiler flags and how to affect the errors and warnings during compilation of the program.
  • Then I learned about the difference between libcxx and libstdc++, and how programs differ when compiled against them.
  • Then I came across problem of effectively testing out my patches and/or pull requests. This is where I learnt to setup custom LXD gentoo images from various stage 3 tarball and setup scripts to easy test out my PR with various combination of USE flags.
  • After that, This year I felt fairly confident enough to approach upstream developers and work with mailing list. But I’m still in the processing of learning to use them and send patches via mailing lists.

My weekly work

I’ll try to put down my weekly work for the whole 12 weeks in brief and points while linking the archived emails of the actual report

Week 1

I’ve been mainly stuck to the plan and
worked on *Wincompatible-function-pointer-types* bugs. Since I was already kind of familiar with some of the working, environment, and tools for Gentoo, I started a bit early and had been working on the aforementioned bugs during the community bonding period which gave me some time to set up a musl machine. This has helped me
solve some of the most specific bugs as *Wincompatible-function-pointer-types* is not limited to only one particular lib, in this case, glibc and musl.

Week 2

I’ve stuck to my proposal and mainly worked on the
“Wincompatible-function-pointer-types” bugs. Honestly, nothing much
interesting did happen. I was not able to work for 2 days, due to some personal health issues, I plan on making up for them in the following weeks/days.  I finished setting up MUSL testing environment (chroot). Got some reviews by my mentor/s meanwhile.

Week 3

For this week I diverted from my initial idea a bit and
focused on the “C++17 does not allow register storage class specific” type
error. Basically, C++14 deprecated the register storage class and it has
been completely removed in C++17, thus resulting in C++ packages that
use register keywords with this kind of error. A general fix is it
either removes the keywords or replaces them with *int* where applicable.

Week 4

Well nothing interesting to report this week, just following my proposal
and focused on -Wimplicit-int type of bug for the first half of the week
while moving to -Wimplicit-function-declaration. But I diverted a bit and picked up some random bug that I sent pull requests for.

Week 5

Patched MATE desktop and related packages. Not only just in Modern C, but it’s now compatible with gettext-0.22. So someone using llvm-musl or the llvm profile
can use MATE desktop.

While fixing MATE settings-daemon I’ve learned two very valuable
lesson (thanks to my Sam),
– Getting feedback from upstream devs is important
– Casting variables in incompatible function pointer type of errors is
not always correct, it might only temporarily fix the problem/silence
the warning.
I’m going to keep this two points in mind for the next and upcoming
weeks.

Apart from the MATE work, I mostly adhered to my proposal timeline and
fixed more -Wimplicit-function-declaration bug, and more misc. bugs.

Week 6

This week I couldn’t do much as I caught a bit of cold and fell ill. But
I’m doing much better now and will begin working again starting this
week. I plan on making up for last weeks work in the coming week and
in case there is still remaining work, I will make it up in the
extra/emergency week at the end. This was also the reason I could not update my blogs for the last week.

Week 7

I picked up where I left before week 6. Sent sent in some patches (no upstream unfortunately).
This week I mainly worked with Juippis (my other mentor) on reviews of
my already submitted PRs. We came across some challenges while doing,
namely reproduction of a bug, the case being juippis and sam_ were able
to reproduce the bug, but I couldn’t due. It was most probably due to
compiler-rt. I still have to send in a proper fix for that bug. Which
brings us the to second topic of setting up a test environment. Juippis
has an excellent guide on using lxc containers for setting up test
environment.

Week 8

Testing environments were set. I now had three environments to test my
PRs on.
– GCC 13 with glibc
– Clang-16 with llvm profile
– Clang-16 with musl-llvm profile

I’ve picked up various random bugs from the tracker list and worked on them. But I’ve come to the realization that my work isn’t just limited to c99 or c11 porting.
It’s is mix between c99 porting, using Clang-16 as the default compiler
and perhaps using lld as the system linker as well. Which of course I’m
very happy about.

Sam wanted me keep him informed when I’m sending my patches upstream or if I had any issues in doing so he can help. So I took care of that from week 8 onwards.

Week 9

Similar to last week, I picked up bugs at random and started submitting
patches. But this time I made sure to check out the upstream and send in
patches whenever possible, if it turned out to be difficult or I
couldn’t find upstream I made sure to make a note about it in the PR
either via commit message or through a separate comment. This way it
helped my Sam keep track of things and my progress.

Week 10

So apart from the usual patching of packages from the tracker the most
significant work done this week is getting GNOME desktop on llvm
profile. But it is to be noted that the packages gui-libs/libhandy,
dev-libs/libgee and sys-libs/libblockdev require gcc fallback
environment. net-dialup/ppp was also on our list but thanks to Sam its
has been patched [0] (and fix sent upstream).

Week 11

Similar to last two weeks I took up bugs from the tracker randomly and
patched them, sending patch upstream whenever possible. Unfortunately,
nothing new or interesting.

Also worked on some reviews with Sam and Joonas.

Week 12

Similar to last week I took up bugs from the tracker randomly and
patched them, sending patch upstream whenever possible. Unfortunately,
nothing new or interesting.

Also been working with Joonas on masking firefox-bin and rust-bin in
glibc llvm profile, Joonas has for now reverted the commit masking
those bin packages, but likely a proper fix will be committed soon.

Just wrapped things up for final review. I’m also in 1:1 contact with
Sam in case there is some major work needed on a particular section of
my project or a package.

About me

If you want to know a bit about me or want to contact me, you can find relevant information here.

Comments are closed.