[webkit-dev] Proposal to enable logging under non-systemd linux distros

Pablo Correa Gomez ablocorrea at hotmail.com
Tue Oct 19 17:07:56 PDT 2021


Dear webkit maintainers,

I am a contributor to postmarketos/alpine linux. We recently bumped
into some runtime crashes in webkit2gtk which were very hard to debug
due to the lack of logging. The reason for the lack of logging seems to
be that alpine configures webkit2gtk with -DPORT=GTK -DUSE_SYSTEMD=OFF
and then the USE_JOURNALD macro does not get set. 

However, in systems like alpine which do not use systemd, it is common
that a compatible logind, elogind[1], be used. When this is the case,
then the current functions used for logging to systemd's journal are
perfectly compatible. To make sure it works, I have create a small
patch/hack to test it, which compiled in a system with elogind instead
of systemd USE_SYSTEMD=ON:

diff -ru a/Source/cmake/FindSystemd.cmake
b/Source/cmake/FindSystemd.cmake
--- a/Source/cmake/FindSystemd.cmake
+++ b/Source/cmake/FindSystemd.cmake
@@ -68,6 +68,11 @@
     HINTS ${PC_SYSTEMD_LIBDIR} ${PC_SYSTEMD_LIBRARY_DIRS}
 )

+find_library(Systemd_LIBRARY
+    NAMES ${Systemd_NAMES} elogind
+    HINTS ${PC_SYSTEMD_LIBDIR} ${PC_SYSTEMD_LIBRARY_DIRS}
+)
+
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Systemd
     FOUND_VAR Systemd_FOUND


I would be happy to contribute a decent patch, but as it would modify
the parameters available for distros to configure, I have some doubts
about which would be the best way to proceed. I could see two options:

 - Create a new configuration option (USE_ELOGIND), most likely
muplicating most of systemd cmake code.
 - Rename USE_SYSTEMD to USE_JOURNALD and have a conditional check
which looks for elogind if libsystemd is not found, similar to the hack
I used for proof-testing.

My question is, which of these two options would be best suitable? If
none of them is, which would be the better way to add the possibility
to configure webkit2gtk using elogind?

Best regards and thank you very much for your time,
Pablo Correa Gómez.

[1] https://github.com/elogind/elogind



More information about the webkit-dev mailing list