Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Rustup Aims to Make Cross-Compiling Rust Much Easier

Rustup Aims to Make Cross-Compiling Rust Much Easier

This item in japanese

Rustup, introduced with Rust 1.8, is a toolchain manager for Rust that aims to make it much easier to cross-compile Rust code. Mozilla engineer Brian Anderson has recently shared more details about it.

Rustup is a command-line application that is able to download and switch between different versions of the Rust toolchain –i.e., its compiler, rustc, and the standard library– for a number of supported platforms. In fact, rustc itself is available on about 56 platforms, while rustup can actually manage compilers for 14 of them and standard libraries for 30.

Additionally, rustup can track specific versions of the toolchain, including Rust’s nightly, beta, and releases channels. By way of example, you can use rustup to check how your program behaves on the next Rust release. To do so, you need install the Rust beta toolchain for your current platform and then run your unit tests with it. Using rustup this can be accomplished by executing:

$ rustup install beta
$ rustup run beta cargo test

As another example, Anderson describes how you can use rustup to create static binaries for Linux that use the musl standard library instead of the usual glibc:

$ rustup target add x86_64-unknown-linux-musl
$ cargo run --target=x86_64-unknown-linux-musl

rustup is still very much a work in progress, as it strives to extend the number of platforms it supports. In particular, rustup is not yet able to seamlessly cross-compile for Android. Indeed, this requires manually downloading the Android NDK and creating a “standalone toolchain” for it. This will be fixed in a future version of rustup, Anderson says, that will extend its capabilities to also acquiring and configuring the required linker and C toolchain. Furthermore, rustup also aims to target the Web through Emscripten.

rustup is the successor to Anderson’s multirust and supersedes it. rustup is still considered beta, but it can be readily installed and tried out.

Rate this Article