The rust support that this page talks about is no longer supported.


This page relates to using cargo based rust modules in userspace on seL4 utilizing the existing build system. It focuses on Interoperability between existing c based libraries and applications and working with CAmkES. For rust only projects on seL4 see the robigalia project.


In addition to the typical sel4 build prerequisites you also need to have rust installed. This is achieved by the following:

# This installs multirust from here:
curl -sf | sh

# This will install cargo and rustc using the current nightly version
multirust update nightly
# This will set the default cargo and rustc paths to the nightly version
multirust default nightly

Additionally, if you want to use rust-bindgen (a helpful tool that generates rust bindings from c header files, such as bindings to camkes generated functions) you need to have libclang installed.

Sample projects:

There is currently a sample project rust-camkes-samples that demonstrates this functionality.

The following commands get a sample camkes hello world app written in rust and runs it on qemu. It assumes that rust is installed correctly.

Note: the last rust nightly version this was specifically tested on is: nightly-2016-06-01. Since then, the build-system and structure of the upstream Rust compiler has changed, and is no longer compatible with our Rust infrastructure. Please continue to use this older nightly version until the project has been updated on our end, in the near future.

# This just gets all of the sources
repo init -u 
repo sync  
# Configuration for arm kzm (so we can use qemu)
# helloworld app: make rust-helloworld-kzm_defconfig
# keyvalue app: make rust-keyvalue-kzm_defconfig
make rust-helloworld-kzm_defconfig
# Build and run on qemu
make qemu-arm

Build Dependencies:

In addition to the existing seL4 dependencies and CAmkES dependencies, the following dependencies are required:

The following features also require extra dependencies, however the particular features are not required to build applications that don’t use the features:

Build overview:

Two features have been added to the seL4 build system (seL4_tools):

#This library uses a rust cargo project to generate it's lib*.a file
RUST_TARGET := libbtreemap.a
# Header files/directories this library provides
# The file is specified directly, as btreemap.h is generated by the rust task
HDRFILES := ${SOURCE_DIR}/include/generated/btreemap.h
include $(SEL4_COMMON)/

To use a cargo project as part of a camkes app component, in the application’s Makefile, COMPONENTNAME_RUST needs to be set to the cargo lib name.

For a non camkes application, to use a cargo project in an app then the settings are the same as for a library: RUST_TARGET := libcratename.a.

Known issues: