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

Alexander E. Patrakov patrakov at gmail.com
Tue Jun 4 02:43:22 PDT 2013


2013/6/4 Lennart Poettering <lennart at poettering.net>:
> On Mon, 03.06.13 00:52, 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"
>
> Static linking is broken for many reasons. One reason is the namespace
> issue you ran into.

I think that there is some misunderstanding of the complaint here,
caused by libtool. Basically, I think that the complaint is: you
provide the --enable-static option, so it should work, even though it
is not the default. Here is what really happens:

1. systemd's (and kmod's) configure.ac uses the LT_INIT macro that
comes from libtool. It is useful for building shared libraries.
2. That macro, among other things, teaches the configure script to
understand the --{en,dis}able-{static,shared} options.
3. Due to reasons already mentioned in this thread, static linking
should not be used for systemd and kmod.
4. The LT_INIT macro has a way to disable the build of static
libraries by default (but the user who runs the configure script can
override this default), and systemd does that.
5. This macro does not have a way to forcibly disable the build of
static libraries.

(5) is a bug in libtool. There is nothing systemd can do about it.

-- 
Alexander E. Patrakov


More information about the systemd-devel mailing list