Hacker News new | past | comments | ask | show | jobs | submit login

systemd does not support static linking due to its use of NSS. See: http://lists.freedesktop.org/archives/systemd-devel/2014-Mar...



> Only the most trivial libraries actually support it.

... what kind of nonsense is that? Almost every library supports static linking to a basic degree at least. Heck, I statically link giant things like Qt and Boost every day at work.


Well the core of the issue here is you can't really staticly link against a library that depends on dlopen/dlsym (nss system is built around this).

I mean, you could, but now your staticly linked binary still depends on other dlsym'd code. So whats the point?

(Not trying to make an argument that this is good or bad behaviour)


I understand, but the question then becomes why your library depends on dlopen and why you don't offer an alternative static method as Qt's "plugins" do. Doesn't seem like good design on the part of the NSS devs to me, and probably a poor choice of library on the part of the systemd devs to me. But maybe I'm missing something.


The library that depends on dlopen is glibc.


You can statically link glibc, so I'm pretty sure that's not right...


I can see systemd as a whole not supporting static linking. But systemd is a collection of many different binaries that each do their thing, so would it be possible for systemd (the pid 1 executable) to be statically linked while the other supporting executables are dynamically linked?


The systemd developers try to avoid using NSS on PID 1 (for very good reasons), so NSS wouldn't be a problem for static linking PID 1.

* See for instance https://bugzilla.redhat.com/show_bug.cgi?id=915912#c18


Sounds like it would just need some changes to their build setup to allow the PID 1 piece to be compiled statically, which doesn't seem too bad.

Of course, this may not even solve the root cause of the problem this article talks about. It would make PID 1 a little more resillient though.


systemd does not support static linking due to its use of NSS.

Well, that is a surprise to me. And something of a concern.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: