[systemd-devel] How to build systemd with statically linking

Samuli Suominen ssuominen at gentoo.org
Sun Mar 2 02:05:33 PST 2014


On 01/03/14 22:07, Lennart Poettering wrote:
> On Sat, 01.03.14 20:36, Samuli Suominen (ssuominen at gentoo.org) wrote:
>
>> On 01/03/14 20:11, Lennart Poettering wrote:
>>> On Sat, 01.03.14 17:46, Ȳ�翵 (j-zero.hwang at samsung.com) wrote:
>>>
>>>> Hello,
>>>>
>>>> I've tried to build systemd(v43) with statically linking.
>>>>
>>>> I revised Makefile.am and spec file but it was not built statically.
>>> We do not support static linking. We probably should turn this off
>>> entirely in the build system if there is a way, to make sure people get
>>> a clean error.
>> configure.ac already has:
>>
>> AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static
>> is not supported by systemd])])
>>
>> as the user was trying to build version 43, that'd explain why he didn't
>> see it, as that snippet wasn't added
>> at that time yet.
>> in any case, please don't make the building of libudev.a any more harder
>> than it is now, i know it has it's
>> pitfalls, and it shouldn't be officially supported in any way, but if
>> you know what you are doing, you can,
>> by removing this snippet from configure.ac, get a semi-working libudev.a
>> which is a prerequisite for
>> building static lvm2/cryptsetup binaries
> Why would you do something like that? That's just broken.
>
> Also the API between udevd and libudev is not stable, you should never
> mix different implementations.
>
> Lennart
>

Well, believe it or not, there are people using udev with alternate
service managers
like runit or openrc with a crypted / and a sep. /usr, without initramfs
And such an setup takes quite a knowledge to setup, so the same people
capable
of doing that, are well aware of the pitfall of mandatory recompile of
the static
binaries in case of an upgrade
I've talked about this with cryptsetup upstream ever since the
configure.ac snippet
was added to systemd, and even cryptsetup upstream *wants* to support such
configuration and sees no reason to remove the support for it
As in, their configure.ac is specifically designed to support building
--enable-static-binaries,
or similar
Same goes for LVM2
Ie. their configure.ac's have calls to `pkg-config --static --libs
libudev $any other package required`
and result ends up in vars like CRYPTSETUP_STATIC_LIBS= or LVM2_STATIC_LIBS=

So, if it's possible, even with some hackery, someone will for sure do it :)


More information about the systemd-devel mailing list