Skip to content

Fix static build dropping all built-in plugins - #514

Merged
troglobit merged 1 commit into
finit-project:masterfrom
vazub:static-fix
Oct 27, 2026
Merged

troglobit merged 1 commit into
finit-project:masterfrom
vazub:static-fix

Conversation

@vazub

@vazub vazub commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

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 that tmpfiles --create never run at boot, because it was supposed to be invoked by bootmisc.

Why a problem? Because the plugins were built into libplug.la and linked into finit. 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-archive via finit_LDFLAGS. Non-static builds keep -export-dynamic, so they are not affected. On top of that, hook-scripts.c was only built in the non-static branch, so --enable-hook-scripts-plugin was silently ignored with --enable-static as well. Added it to the static list.

Since the change is against Makefile.am files, an ./autogen.sh run would be required to propagate it further.

@troglobit

Copy link
Copy Markdown
Collaborator

OK, since you're targeting this to master and not the 4.x branch, should I take it you're now officially on "team static", as I asked back in #368 (comment) ? Because I was honestly still on track to drop static support due to the lack of a reply.

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.

@vazub

vazub commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

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 ;)

@troglobit

Copy link
Copy Markdown
Collaborator

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

@troglobit
troglobit merged commit a220e0f into finit-project:master Oct 27, 2026
4 checks passed
@troglobit

Copy link
Copy Markdown
Collaborator

Cherry-picked to the stable 4.x branch as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop '--enable-static' configure option, broken with too much maint overhead

2 participants