tormol / tiny-rust-executable

Using Rust to make a 137-byte static AMD64 Linux executable
http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-static-linux-binary-in-rust.html
Apache License 2.0
16 stars 1 forks source link

Cargo support? #1

Open d33tah opened 4 years ago

d33tah commented 4 years ago

Awesome demo, thanks! Just curious, how difficult would it be do make it build with Cargo?

tormol commented 3 years ago

Building with cargo would be nice, so I looked into it.

Corgo desn't seem to have any way of post-processing the output of rustc, so getting cargo build to create the final binary appears to be impossible. Passing custom flags to rustc through cargo build is possible however, so I've now created a cargo project and changed build.sh to invoke cargo instead of rustc. This lets us use cargo's dependency resolution and more familiar ways of setting compilation options.