Xargo v0.2.0 - effortless cross compilation to (custom) bare metal targets

Hey, Rustaceans!

I'm here to announce the version 0.2.0 of Xargo!

For those that don't know, Xargo is a "transparent" Cargo wrapper that builds and manages "sysroots"
for targets that don't have binary releases of standard crates like core. In a nutshell, you can
use Xargo, just like you'd use Cargo, to cross compile Rust program/libraries for no_std targets
like thumbv7em-none-eabihf. See below:

Screenshot

The notable changes for this release:

  • Xargo no longer depends on the cargo crate or the curl crate. This means that Xargo doesn't
    depend on libcurl.so, libssh2.so, etc. either. This makes Xargo easier to cargo install (no
    more weird C compiler/make/cmake errors, yay!) and also makes its binary releases more portable.
  • But, to achieve that, Xargo now depends on the rust-src component being installed (Xargo will no
    longer download the Rust source itself). You can install it using rustup: rustup component add rust-src.
  • Binary releases are back up and now include fully statically linked binaries for Linux!

Enjoy!

P.S. error-chain is awesome!
P.P.S. Cargo's flock is also awesome!

13 Likes

Do you know how to install the rust-src when using Travis?

Do you know how to install the rust-src when using Travis?

I answered this on IRC but for reference:

  • The simplest way to fix this is to install the version 0.1.x of Xargo: cargo install xargo --vers 0.1.14.

  • The proper way to fix this is to install the rust-src component along with rustup. Add these
    to your .travis.yml install phase (before installing Xargo):

- curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
- source ~/.cargo/env
- rustup component add rust-src
1 Like

Is a panic=abort sysroot needed when building code (say, a kernel) when the Cargo.toml specifies aborting panic? If so, is it possible to build one with xargo?

If you create a custom target and set "panic": "abort" in its .json file, Xargo will compile a sysroot assuming panic=abort (and you won't have to define the eh_personality lang item). Alternatively, you can set panic=abort in the profile (Cargo.toml) and not in the target specification; Xargo will also build the sysroot using panic=abort.

1 Like

Thanks!