This document provides instructions on how to build the Ocre Runtime from source without requiring Docker. These instructions also work inside a docker container, however this is provided as a reference for whose who need the development enviroment available in the host.
For quick instructions on how to build the Ocre Runtime (potentially using docker), see Devcontainers, Getting Started with Linux and Getting Started with Zephyr documents.
We detail the procedure to set up the host system prerequisites, and build a native Linux version of the Ocre Runtime, and also how to set up a Zephyr development environment locally, which includes Ocre.
These prerequisites are necessary both for Linux and Zephyr build.
Our reference system is a Ubuntu 24.04 LTS, however these instructions can be easily adapted for other Linux distributions, as well as other POSIX based operating systems.
Ocre requires CMake and a C compiler such as GCC. For full testing support, we also use clang. If we are checking out the Ocre repository, we also need Git to clone Ocre Runtime, and Wget to unpack wasi-sysroot. Install all with:
sudo apt update -y
sudo apt install -y apt install build-essential git cmake clang wget libclang-rt-dev-wasm32 lldFor building WASM/WASI containers (including the test containers), we need the WASI Sysroot.
Download wasi-sysroot from the WASI SDK releases page for your platform. The current recommended version is wasi-sysroot-29.
This is usually installed under /opt/wasi-sysroot for default easy usage without the need to set environment variables.
Download, unpack and install wasi-sysroot:
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sysroot-29.0.tar.gz
tar -xzf wasi-sysroot-29.0.tar.gz
sudo mv wasi-sysroot-29.0 /opt/wasi-sysrootThis environment is enough to build and run Ocre on Linux:
git clone --recursive https://github.com/project-ocre/ocre-runtime.git
cd ocre-runtime
mkdir build
cd build
cmake ..
makeCheck the Getting Started with Linux and Linux Build System for more information.
As stated in the Zephyr Getting Started Guide,
Zephyr requires additional tools such as python3 among others. We can install them with:
sudo apt update -y
sudo apt install --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget python3-dev python3-venv python3-tk \
xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1Then we need west. This is usually done in the venv because we might need some more Python packages and we do not want to tamper with the system Python packages (which are outside of the virtual environment).
Create a virtual environment:
python3 -m venv .venv
source venv/bin/activateInstall west:
pip install westNow you can proceed to build your Zephyr application as detailed in Zephyr's Getting Started Guide.
Alternatively you can check Get Started with Zephyr and Custom Zephyr Application to build a custom application or the Ocre samples.
You can also check the Zephyr Build System for more information about the build configuration.