{{tag>Brouillon Lang Rust x86}} # Notes rust lang compilation Voir : * [[Notes rust lang]] ~~~bash sudo apt-get install cargo ~~~ ~~~bash cargo new hello-world cd hello-world/ ~~~ `src/main.rs` ~~~rust fn main() { println!("Hello, world!"); } ~~~ ## Compilation Compilation basique ~~~bash rustc src/main.rs ~~~ Compilation statique ~~~bash sudo apt-get install librust-rustup-dev rustup rustup default stable rustup target add x86_64-unknown-linux-musl cargo build --target=x86_64-unknown-linux-musl ~~~ ~~~ $ ldd ./target/x86_64-unknown-linux-musl/debug/hello-world statically linked ~~~ Compilation 32bits pour windows ~~~bash rustup target add i686-pc-windows-gnu cargo build --target=i686-pc-windows-gnu # cargo build --release --target=i686-pc-windows-gnu wine target/i686-pc-windows-gnu/debug/hello-world.exe ~~~ Compilation 32bits statique pour GNU/Linux ~~~bash rustup target add i686-unknown-linux-musl cargo build --target i686-unknown-linux-musl ~~~