Setting up our tutorial environment

To run the example in our two parttutorial, , create an example directory where our example app and tools will live, and enter that directory:

mkdir example
cd example

Next, clone the repo for this book, which contains our example code, and copy it to its own directory, and build the example code.

git clone [email protected]:PLSysSec/rlbox-book.git
mkdir myapp
cp -r rlbox-book/src/chapters/examples/noop-hello-example/* myapp
cd myapp
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build --config Release --parallel

Then run it to make sure everything is working.


You should see the following output:

Hello from mylib
Adding... 3+4 = 7
Adding... 3+4 = 7
OK? = 1
echo: hi hi!
hello_cb: hi again!

Finally, return to the example directory, and clone and build our wasm toolchain, which includes fork of wasm2c, the wasi-sdk (everything you need to compile your C to wasm).

cd ..
git clone
cd rlbox_wasm2c_sandbox
cmake -S . -B ./build
cmake --build ./build --target all
cd ..