2 ms·
Doing basic imports is a valuable addition to hello world, as it demonstrates the tool-chain is working :-) I just found out that my rustc-arguments probably w
by e12e 12y ago
Doing basic imports is a valuable addition to hello world, as it demonstrates the tool-chain is working :-)
I just found out that my rustc-arguments probably were wrong (for most uses, anyway). Or rather, they link dynamically to the rust standard library -- which while "equal" to C, won't hold most of the time. All (non-embedded) systems will have libc for the foreseeable future -- assuming that they have rust libstd is probably not a good assumption to make.
I found this out after I upgraded to rust-1.0, and the lib/libstd-<hash?>.so files changed names.
So while:
rustc -O -C prefer-dynamic -o hello hello.rs
works, that produces a really dynamically linked little binary. One probably wants:
rustc -O -o hello hello.rs
This statically compiles in the rust std lib, and leaves a binary that's ~332k after stripping.
(Btw, -O is equivalent to -C opt-level=2)