BT

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

Rustup Aims to Make Cross-Compiling Rust Much Easier

Bookmarks

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

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.