How to reduce the size of rustup dependencies?

I'm trying to install something on a VPS that requires Rust to launch. Running rustup used over 1 GB, which is not ideal for my host, as I now have only 300 MB left.

Can I reduce the disk usage in any way? I tried to run binaries from another machine, but I had no luck without GLIBC_2.39.

Thanks

1 Like

There's --profile=minimal rustup flag that omits documentation, clippy, etc. rustup component remove clippy can slim it too.

However, you will soon find that debug info and other temporary files saved by Rust/Cargo require even more disk space. It is a bit ridiculous how much is space is needed. Disabling debug info and incremental compilation helps, but may not be enough.

If your VPS supports mounting additional volumes, you could use that to add more disk space temporarily.

You could use a container (like Docker) or a vm with the same operating system that your VPS has to build compatible binaries on a bigger machine.

You can use Rust MUSL targets to avoid glibc compatibility issues (but still beware of other C dependencies like openssl that may end up linked dynamically and require specific versions).

5 Likes