Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rustup, Cargo and Cross-compiling in Rust

Rustup, Cargo and Cross-compiling in Rust

These are slides for a hands-on presentation demonstrating the tooling around the Rust programming language at present. They cover rustup, cargo and theoretical aspects of cross-compiling programs in Rust.

These slides were presented at the Rust Meetup Bangalore - July 2016 hosted at Red Hat Bangalore.

Kaustav Das Modak

July 02, 2016
Tweet

More Decks by Kaustav Das Modak

Other Decks in Technology

Transcript

  1. Rustup,
    Cargo and
    Cross-compiling Rust programs
    Kaustav Das Modak | @kaustavdm

    View full-size slide

  2. https://rustup.rs
    Toolchain manager for Rust

    View full-size slide

  3. $ rustup toolchain install nightly
    $ rustup toolchain list
    Install multiple rustc

    View full-size slide

  4. $ rustup run nightly rustc hello.rs
    $ rustup run stable rustc hello.rs
    Compile with multiple rustc versions

    View full-size slide

  5. $ rustup target list
    $ rustup target add
    Add other compile targets

    View full-size slide

  6. $ rustup update
    $ rustup update nightly
    Keep updated

    View full-size slide

  7. $ curl https://sh.rustup.rs -sSf | sh
    Install rustup and play around

    View full-size slide

  8. $ cargo
    Manage dependencies & builds

    View full-size slide

  9. $ cargo new hello --bin
    Create a new cargo project

    View full-size slide

  10. $ cargo build
    $ cargo run
    Build (run) the project

    View full-size slide

  11. $ cargo install
    Install from crates.io

    View full-size slide

  12. $ cargo build
    Dependencies are fetched and built

    View full-size slide

  13. $ cargo build
    Dependencies are fetched and built

    View full-size slide

  14. Cross-compiling
    add rustc target
    install proper linker
    tell cargo about the linker
    cargo build --target=

    View full-size slide