Setting up a build environment

For a number of reasons, setting up a build environment for Robigalia can be somewhat convoluted. Rust does not have built-in support for targeting seL4. Libraries need to be built for cross-compiling. Some nightly features are also needed (inline assembly) for interfacing with the kernel.

Ubuntu 16.04 is the only tested and supported build environment, though it is likely that any Linux distribution will work. Windows and OS X are not currently supported as build environments. BSDs have not been tested, but it is likely that they will work with little modification.

There are two options: using the Vagrant VM we supply, or setting up everything yourself. We recommend using the VM for ease, but recognize that it’s not a substitute for detailed documentation.

Read on if you want to know how to setup a build environment manually. You could also inspect the bootstrap script Vagrant uses, which you could adapt to work for your environment.

Rust compiler

First, you need suitable Rust and C compilers.

For Rust, any nightly compiler newer than 2016-10-14 should work. It must be nightly, not beta or stable. The easiest way to install a suitable Rust is rustup, and running

rustup default nightly-2016-12-29

Be sure to note the prefix that Rust is installed in, which we’ll call $PREFIX from here on. If you’re using rustup, it’s probably ~/.multirust/toolchains/nightly.

C compiler + standard library

The targets you want to build for will determine which C compilers you need. The C compiler is needed to build compiler-rt by xargo , and is used as the linker.

The easiest thing is to install a clang and LLVM toolchain. You can run llc --version, and if x86 and arm are listed, you are good to go!

Getting the target configuration

The sel4-targets repository has so-called "target specifications" for rustc. Clone this repository somewhere and set the environment variable RUST_TARGET_PATH to that directory.

xargo

We use xargo for handling some of the fiddly details of cross-compilation to custom targets. You can install it with cargo install xargo, and everything should Just Work. There are binaries available as well, linked from xargo’s readme.

Now you’re set! You should be able to invoke xargo with --target i686-sel4-robigalia (or the others) now, and it will work correctly.

Troubleshooting

If you tried following these steps but came across an error, please come to our IRC channel or mailing list so we can help you, and add more details to this section. Thanks!