Split sysroot into runtime libs and compile-time bits #136373
Labels
A-dynamic-library
Area: Dynamic/Shared Libraries
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
O-NixOS
Operating system: NixOS, https://nixos.org/
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I have built this rust executable:
like so:
It has this runpath:
Of particular note here is the
/nix/store/y4wsjfgpavqs0y371frl5vgpc50fyr3w-rustc-1.82.0/lib/rustlib/aarch64-unknown-linux-gnu/lib
: this is a problem!rustc
and its transitive dependencies are over 1GB in size, which means that executables distributed with dynamic libstd cannot be distributed if they link to the toolchain's copy of libstd.However, it's pretty reasonable to actually use the toolchain's libraries at runtime, they just have to be able to be configured to go somewhere else.
See, from the above, these libs from gcc (libgcc_s.so, libasah.so, etc etc etc) which basically everything is linked to:
It needs to be possible to ship rustc's runtime libs like
libstd-foo.so
without shipping an entire rest of a sysroot and compiler along with them. We can hack around this at a packaging level by doing some truly horrible fixups to every rust build after the fact, but it's not really reasonable to do to every single package: the compiler needs to be able to look somewhere different for its libstd dynamic libs so it just works.The way that this would probably look like is that rustc has a separate install directory of runtime libs which is set up at configure time in a similar way to the main install directory and then that's the paths it would give to the linker when linking.
Discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/libstd.2C.20rpath.2C.20dylibs.20and.20packaging
Relevant (I believe!) code:
rust/compiler/rustc_session/src/filesearch.rs
Lines 48 to 59 in 84ce2e1
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: