Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is cute, but is there a way to actually create static binaries with the standard tooling and not jumping through hoops?

Hello World in Rust with tip of tree (as of yesterday) is a ~500K binary that depends on glibc and friends.

Switching from println!() to std::io...write_str() actually made it larger!



You can't static link glibc, so our static binaries still have a dynamic dependency on it.


Is there a process for making a fully static binary (say if I were to substitute an alternate libc, or provide my own low level wrappers for syscalls, or whatnot)?


Yes, that's totally possible. You can write a kernel in Rust if you want.


...is it documented anywhere? where?



The example minimal do-nothing program there is much smaller (8k), but still results in a dynamic binary requiring glibc.

The only unresolved symbol is: __libc_start_main@@GLIBC_2.2.5


I believe musl supports static linking


Any reason one couldn't use musl instead for static linking? (http://www.musl-libc.org/)


and for many, there are legal issues with statically linking glibc due to its license.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: