Outils pour utilisateurs

Outils du site


tech:notes_rust_lang_compilation

Ceci est une ancienne révision du document !


Notes rust lang compilation

sudo apt-get install cargo
cargo new hello-world
 
cd hello-world/

src/main.rs

fn main() {
    println!("Hello, world!");
}

Compilation

Compilation basique

rustc src/main.rs

Compilation statioque

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

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

rustup target add i686-unknown-linux-musl
cargo build --target i686-unknown-linux-musl
tech/notes_rust_lang_compilation.1794418519.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki