Static linking of Rust binaries is supported on the x86_64-unknown-linux-musl target only: https://doc.rust-lang.org/book/advanced-linking.html It would be great if Gentoo would (optionally) build Rust with support for the x86_64-unknown-linux-musl target. Please note that this is not related to bug #598892.
Was it merged into master today https://github.com/rust-lang/rust/pull/40113
(In reply to Oleg from comment #1) > Was it merged into master today https://github.com/rust-lang/rust/pull/40113 I think that PR covers dynamic linking with x86_64-unknown-linux-musl? And in any case, Gentoo needs to support the additional target, before this can be used.
(In reply to Dennis Schridde from comment #0) > It would be great if Gentoo would (optionally) build Rust with support for > the x86_64-unknown-linux-musl target. Building a rustc that can target musl requires having musl available for linking libstd, so that would make dev-lang/rust depend on sys-libs/musl. Unfortunately, sys-libs/musl conflicts with glibc.
not going to implement this as an additional target for ::gentoo rust, however on musl hosts rust works nowadays (rust and rust-bin) and can emit static libraries. while not very convenient, you can have a musl chroot with rust-bin, it will produce static binaries by default.