News for hackers. Stuff that matters.
Re:Porting Rust's Std to Rustix by styfle on Tuesday January 04, 2022 @08:29AM (#29794452)
Does this mean we could have a single binary for x86_64 linux instead of two (glibc and musl)?

x86_64-unknown-linux-gnu

x86_64-unknown-linux-musl

Re:Porting Rust's Std to Rustix by sanxiyn on Tuesday January 04, 2022 @08:34AM (#29794495)
No, it means there will be three binaries instead of two.

Note that statically linked musl binaries run fine on glibc Linux, so you can just distribute musl binaries. That works right now. In the future, you will just distribute Rustix binaries, which will be hopefully smaller than musl binaries (because it doesn't need to support C API).

Re:Porting Rust's Std to Rustix by CodesInChaos on Tuesday January 04, 2022 @09:50AM (#29795329)
I expect 4 options:

* glibc linked dynamically

* musl linked dynamically

* musl linked statically

* direct syscalls from rust

and possibly additional options choosing if math functions, memcpy, etc. should use an implementation shipped with rust or one shipped with libc.

The big question is if we'll get to a point where almost all rust application don't use a libc at all.

Re:Porting Rust's Std to Rustix by masklinn on Tuesday January 04, 2022 @11:22AM (#29796514)
> * musl linked dynamically

> * musl linked statically

This is handled through the orthogonal "crt-static" target-feature.

IIRC each supported CRT has a preference, but for some that can be overridden (musl would be one of those, possibly one of few of those since statically linking glibc is generally recommended against, and so's pretty much every non-linux libc, when that's an option at all).