[systemd-devel] systemd fails to build with static kmod library

Lucas De Marchi lucas.demarchi at profusion.mobi
Mon Jun 3 06:32:50 PDT 2013


On Sun, Jun 2, 2013 at 7:52 PM, Stephan Raue <mailinglists at openelec.tv> wrote:
> Am 02.06.2013 19:36, schrieb Greg KH:
>>
>> On Sun, Jun 02, 2013 at 07:28:57PM +0200, Stephan Raue wrote:
>>
>>> i dont agree, i some cases it makes sense. since udev is included in
>>> systemd and udev has now its own buildins for the modprobe stuff it
>>> should be possible to use kmod statically linked, esp. if no other
>>> installed program uses kmod (and for our usage the kmod userspace
>>> binarys are not neccessary)
>>
>>
>> If you are so worried about other programs / users calling kmod, then
>> just build your needed kernel modules into the kernel and don't use any
>> kernel modules at all.
>>
> i am not much worried about this, but more about the comment "Do not use
> static linking, with systemd, ever, in fact do not use with any other
> component.". Statically linking works for so many programs and even kmod
> supports the "--enable-static" configure option. So basically i tried to
> report this broken behavior, because i never seen a statement like "dont
> link anything statically against systemd"

It's not advised to do it, so it's up to you to fix it in your custom
build. Basically what you could do either of these in libkmod.a:

1) Rename the clashing symbols with objcopy (use --redefine-sym option)
2) Localize symbols with objcopy (--localize-hidden)
3) Extract the .o objects (ar -x) and relink them into a single .o (ld
-r). Then turn it into a .a using libtool --static

If you integrate (2) or (3) nicely in the build system I think it
could be acceptable upstream.

Another option is... while building systemd, you could achieve
something similar to (2) above without the trouble of modifying
libkmod.a by passing "-Wl,--exclude-libs,ALL" in LDFLAGS (untested).


Lucas De Marchi


More information about the systemd-devel mailing list