-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Add a "slim" staticlib variant that does not include a copy of std #111594
Copy link
Copy link
Open
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently when building a
staticlib, the resulting static library contains a copy of all of std and various other things. This makes the minimum size of astaticlibsomething around 20MB with Rust 1.69 on Linux x86-64, which is not exactly small.This is currently a blocker for GStreamer to ship (static) plugins written in Rust on Android/iOS (and elsewhere) as that adds up to a couple of 100MB.
While this can in theory be solved after the fact by repackaging the
ararchives and having a single copy of std, this seems like something that could be useful to solve in general.An obvious solution here would be having some kind of "slim"
staticlibvariant which does not include a copy of everything every time but instead require the final linking step (to an executable or shared library) to list a staticlibstd.a(among other things). This would also require to ship a static version of std together with the already existing shared version.--print native-static-libswould then print all those other static libraries too.