r/systemd • • 19d ago

systemd developers explain how Rust will be used: standalone components only, core libraries stay in C

https://amutable.com/blog/systemd-loves-rust
10 Upvotes

5 comments sorted by

4

u/fdelux6 19d ago edited 19d ago

EDIT: added "for now" to match the post.

Short summary for anyone who doesn't want to read the whole post.

systemd merged Rust support recently (PR #44324). Rust is allowed for standalone binaries only. The core shared library, libsystemd-shared.so, stays C for now. The authors say the blocker is Rust's lack of first-class shared library support (the stable ABI problem). Without it, Rust code would be duplicated across many libraries and binaries.

The core C functionality is wrapped as Rust crates. Rust binaries use the same internal APIs as the C ones. Rust and C binaries are meant to behave the same, including option parsing, help output and error messages.

Rust is built with Meson, not Cargo. Cargo was rejected over the extra build system and supply chain concerns. Rust code uses no_std for now, with fallible allocations through a systemd allocator crate. External crates are not ruled out, but the project wants more experience first.

They also say existing C code won't be rewritten just to switch languages. Rust support stays optional for now, and systemd without Rust remains fully supported.

The post was written by Christian Brauner and Lennart Poettering.

2

u/aioeu 19d ago

Rust support stays optional, and systemd without Rust remains fully supported.

As a bit of "expectation management", I think it's important to stress that this is just the current situation. I do not think it is a goal to keep systemd usable without Rust support forever.

Further on in that post, they do say:

systemd would also like to see Rust adopted in core components and is willing to engage with the Rust community to make this a reality.

2

u/fdelux6 19d ago

Agree with aioeu. The post says "for now at least" about Rust staying optional, and "(currently)" about the shared library. I should have kept that wording in my summary.

2

u/ranjop 19d ago

The whole post signals very positive and pragmatic attitude towards Rust with practical steps what can be done in the initial phase.

The lack of stable ABI in Rust is a real practical limitation. Therefore focus on standalone binary utils first.

0

u/amarao_san 19d ago

... stay in C, because nowadays software in C loves to receive unexpected updates against unexpected "features".