D6631: Fix compilation with strict libc (such as musl)
mpyne added a comment. In https://phabricator.kde.org/D6631#126937, @bcooksley wrote: > Sorry, looks like it's still unhappy (another different error). This time it's complaining about gettimeofday() > According to https://github.com/kinetiknz/cubeb/issues/6 defining XOPEN_SOURCE will sort this, but i'm not sure if musl is okay with that? musl is fine with `XOPEN_SOURCE` as long as it's defined properly. It implies `_POSIX_C_SOURCE` in the FreeBSD headers anyways, though musl amusingly doesn't care at all for `gettimeofday`. musl *did* care for signals-related functions, but it defines those under `_XOPEN_SOURCE` as well (see https://anonscm.debian.org/cgit/collab-maint/musl.git/tree/include/signal.h). I'll take a look. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: bcooksley, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
bcooksley added a comment. Sorry, looks like it's still unhappy (another different error). This time it's complaining about gettimeofday() According to https://github.com/kinetiknz/cubeb/issues/6 defining XOPEN_SOURCE will sort this, but i'm not sure if musl is okay with that? REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: bcooksley, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
mpyne added a comment. In https://phabricator.kde.org/D6631#126366, @bcooksley wrote: > Thanks for the quick fix. > > Getting closer - got a different error this time... > https://build.kde.org/job/Plasma%20ksysguard%20kf5-qt5%20FreeBSDQt5.7/7/ This fix wasn't as quick, I had to regenerate my musl environment, but I've pushed a commit which should hopefully make it to the end by removing an unneeded internal include (sys/file.h). REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: bcooksley, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
bcooksley added a comment. Thanks for the quick fix. Getting closer - got a different error this time... https://build.kde.org/job/Plasma%20ksysguard%20kf5-qt5%20FreeBSDQt5.7/7/ REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: bcooksley, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
mpyne added a comment. In https://phabricator.kde.org/D6631#126101, @bcooksley wrote: > Clang doesn't seem to like this: https://build.kde.org/job/Plasma%20ksysguard%20kf5-qt5%20FreeBSDQt5.7/4/console Thanks. Looks from the build log like it's not good enough to define the `_POSIX_C_SOURCE` macro and let it take a default meaning, it needs to be defined to a specific value. I've pushed a fix which I hope will make it through CI. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: bcooksley, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
bcooksley added a comment. Clang doesn't seem to like this: https://build.kde.org/job/Plasma%20ksysguard%20kf5-qt5%20FreeBSDQt5.7/4/console REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: bcooksley, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
This revision was automatically updated to reflect the committed changes. Closed by commit R106:257591cf462d: Fix compilation with strict libc (such as musl). (authored by mpyne). REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D6631?vs=16520=16590 REVISION DETAIL https://phabricator.kde.org/D6631 AFFECTED FILES ksysguardd/Command.c ksysguardd/Linux/ProcessList.c ksysguardd/Linux/diskstat.c ksysguardd/Linux/netstat.c ksysguardd/Linux/softraid.c ksysguardd/PWUIDCache.c ksysguardd/conf.c ksysguardd/ksysguardd.c To: mpyne, #plasma, mart Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
mart accepted this revision. This revision is now accepted and ready to land. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma, mart Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
mpyne edited the summary of this revision. mpyne removed a reviewer: Frameworks. mpyne changed the repository for this revision from R111 KSysguard Library to R106 KSysguard. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D6631 To: mpyne, #plasma Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
D6631: Fix compilation with strict libc (such as musl)
mpyne created this revision. Restricted Application added a project: Plasma. Restricted Application added a subscriber: plasma-devel. REVISION SUMMARY Many of the functions we use implicitly are not part of the C standard library so we have to specific that we're pulling from POSIX, X/Open, BSD, or whatever standard we're using before we can rely on the definition being available. There's plenty of room for refactoring here since I mostly stopped at just getting the functions being called to show up from their includes, although I did replace rindex with strrchr since the latter is standardized, and replaced `uint` with `unsigned` rather than trying to figure out what header includes those. TEST PLAN Now compiles against musl libc Still compiles against glibc. REPOSITORY R111 KSysguard Library REVISION DETAIL https://phabricator.kde.org/D6631 AFFECTED FILES ksysguardd/Command.c ksysguardd/Linux/ProcessList.c ksysguardd/Linux/diskstat.c ksysguardd/Linux/netstat.c ksysguardd/Linux/softraid.c ksysguardd/PWUIDCache.c ksysguardd/conf.c ksysguardd/ksysguardd.c To: mpyne, #plasma, #frameworks Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas