Gentoo Archives: gentoo-soc

From: listout <brahmajit.xyz@×××××.com>
To: gentoo-soc <gentoo-soc@l.g.o>
Cc: sam <sam@g.o>, dilfridge <dilfridge@g.o>
Subject: [gentoo-soc] Week 9 Report for Musl support expansion to support GNOME desktop
Date: Mon, 15 Aug 2022 07:51:25
Message-Id: 20220815075107.weiuo7abimvbasag@gmail.com
1 Hello there folks, hope you are doing well.
2
3 With the end of week 9 I'm here with the weekly report on on musl
4 support expansion for GNOME desktop. For this week I've fixed a few bugs
5 for my mentor, Sam. These bugs were in software that he uses personally
6 and I'm happy that I was able to fix them in minimal time. I'll talk
7 about the bugs and fixes a little bit more in detail later, but other
8 than that I've also managed to build blender on musl profile, will too
9 I'll discuss later it the report.
10
11 The bugs that Sam requested to me look into were in folly and watchman,
12 respectively. Both for these programs come from Facebook. For the
13 package folly, it was expecting a define, `__ELF_NATIVE_CLASS`, on
14 systems other than FreeBSD, the `__ELF_NATIVE_CLASS` is also used to
15 define another `FOLLY_ELF_NATIVE_CLASS`. But unfortunately on musl it
16 was not the case, and as a result `FOLLY_ELF_NATIVE_CLASS` was not
17 being defined. Hence, instead of relying on FreeBSD and LP64, we now
18 only check for LP64 and define `FOLLY_ELF_NATIVE_CLASS`. This was
19 initially proposed on a relevant github issue [1], and my PR can be
20 found here [2].
21
22
23 For watchman, the developers used `__fswort_t` as a type for a variable
24 but unfortunately this is an internal glibc type and cannot be used on
25 other libc's. Hence following the advice from Linux manpages and Richard
26 <dalias> on IRC, I changed the type to `unsigned long`. Since `unsigned
27 long` is available on all most all libc's we wouldn't have any problems
28 on future. My conclusion on using `unsigned long` instead of `unsigned
29 int` like Linux manpages stated was due to `__fswort_t` itself being on
30 long type [3] and you can find my PR over here [4].
31
32 Last but not the least, blender. However, before going into blender, I
33 had to fix one on blender's dependencies named opencolorio [5].
34 opencolorio seemed to be using a function `::strtol_l`. I'm not at all
35 familiar with the uses of this particular function. The compiler issues
36 a suggestion of using `::strtol` instead of `::strtol_l` and after a bit
37 of googling I happen to come across Alpine Linux's patch [6] for this
38 and they too used `::strtol`. Therefore I choose to use the `::strtol`
39 function wrapped around a `ifdef __GLIBC__`. I took Alpine Linux's patch
40 in as is manner, hence not providing the like to PR.
41
42 For blender, it required a little bit patching, four to be exact. I'll
43 try by best to explain most of them. I'll start with the most simple
44 patch of these four. In the file *intern/libc_compat/libc_compat.c* the
45 developers wanted to check if a certain version of glibc was present
46 before going further. On non glibc systems, the macro used to check the
47 version (`__GLIBC_PREREQ(2, 31)`) caused a build error. Hence I though
48 it would be appropriate to first check for the existence of glibc, with
49 the status of definition of macro `__GLIBC_PREREQ` before checking the
50 glibc version. I actually came up with this version of the patch with
51 the help from a person on blender.chat.
52
53 For the next three patches, it were almost same. Don't use the
54 header/functions is they are not available with current libc. For this I
55 use the Cmake build systems `CHECK_SYMBOL_EXISTS` and
56 `CHECK_INCLUDE_FILES`. Other Linux distributions like Void and Alpine
57 were already using a version of these patches, just that they are not
58 generalist in nature and not suitable for sending upstream. You can
59 actually see what I've done here [7].
60
61 I'm trying to send all of these patches upstream, lets hope for the
62 best. That will it for this weeks report, hope to bring you more next
63 week (unfortunately not much week of GSoC is left).
64
65 [1]: https://github.com/facebook/folly/issues/1478#issuecomment-719883898
66 [2]: https://github.com/gentoo/gentoo/pull/26807
67 [3]: https://code.woboq.org/qt5/include/bits/typesizes.h.html#46
68 [4]: https://github.com/gentoo/gentoo/pull/26850
69 [5]: https://opencolorio.org/
70 [6]: https://github.com/gentoo/gentoo/pull/26855
71 [7]: https://github.com/gentoo/gentoo/pull/26860
72 --
73 Regards,
74 listout