There are two paths towards building small binaries:
- build all of your dependencies yourself (including standard libs) and ensure they're built with LTO, and link everything statically. Everything you don't actually need will be removed.
- link everything dynamically. The total image size is huge, but technically it's not part of your binary, and can be shared with other binaries as well.