Repository navigation
Fix static build dropping all built-in plugins - #514
Conversation
|
OK, since you're targeting this to Don't get me wrong, I really (!) appreciate your submissions now and in the past, but you're like the only one I've heard from that rely on the static build option for Finit. |
|
Finit is the init I officially use in my custom linux distro, and I am interested in supporting this feature. So I am fine being "team static" here then ;) |
Awesome, thank you! 😃 Merging |
|
Cherry-picked to the stable 4.x branch as well. |
Fixes #368.
As someone who builds Finit statically, I finally got to fulfill the long overdue promise of providing a patch. Turned out to be a simple build fix, nothing on the code side.
So what was originally broken there? With
--enable-static, the built-in plugins (bootmisc, pidfile, procps, urandom, rtc, netlink, tty, and the rest) were not linked into final finit binary. The build succeeded and finit would start, but features provided by the plugins were silently missing. The most visible symptom was thattmpfiles --createnever run at boot, because it was supposed to be invoked by bootmisc.Why a problem? Because the plugins were built into
libplug.laand linked intofinit. They registered themselves with PLUGIN_INIT() constructors, and nothing else referenced them. The linker only pulls archive members that satisfy an undefined symbol, so every plugin object was silently discarded.The fix is straightforward - link the archive with
-Wl,--whole-archive,../plugins/libplug.a,--no-whole-archivevia finit_LDFLAGS. Non-static builds keep-export-dynamic, so they are not affected. On top of that,hook-scripts.cwas only built in the non-static branch, so--enable-hook-scripts-pluginwas silently ignored with--enable-staticas well. Added it to the static list.Since the change is against
Makefile.amfiles, an./autogen.shrun would be required to propagate it further.