Skip to content

Getting Started

  1. Make sure to read the Basics first.
  2. If you want to start contributing, check out the Contributor Instructions.
  3. Continue reading to run a Hello World program in the Lind Sandbox.

Hello World!

1. Set up the environment

Run the following commands in your terminal to download and shell into an environment that comes with the Lind Sandbox. You'll need Docker installed.

docker pull --platform=linux/amd64 securesystemslab/lind-wasm-dev  # this might take a while ...
docker run --platform=linux/amd64 -it securesystemslab/lind-wasm-dev /bin/bash

This is a development environment with tooling and source code available, additional instructions to be found here

2. Write a program

In the same terminal, use e.g. vi to write a hello.c program to be executed in the Lind sandbox. You can also just paste the snippet below.

cat << EOF > hello.c
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}
EOF

3. Compile Lind-Wasm Runtime

Lind-wasm runtime must be compiled before running the program. To compile the lind-wasm runtime, you will first go to the lind-wasm/ directory. At there, you can choose:

3.a. use make all to compile both lind-glibc and rust code at once.

3.b. use make lind-boot to compile runtime(lind-boot/wasmtime/rawposix/3i/etc.), and make sysroot to compile lind-glibc.

NOTES: More options can be found in lind-wasm/Makefile

3. Compile and run

Use lind scripts to compile and run your program in the Lind Sandbox.

lind-clang hello.c
lind-wasm hello.cwasm

Here is what happens under the hood:

  1. lind-clang(aka scripts/lind_compile) compiles hello.c into a WebAssembly (WASM) binary that is linked against lind-glibc, and put into lind file system root(lind-wasm/lindfs).
  2. lind-wasm(aka scripts/lind_run) runs the compiled wasm using lind-wasm runtime and the lind-posix microvisor.

To compile a Rust crate into a lind-glibc linked WASM binary, follow this guide: Compiling Rust Code with lind-glibc

What's next!

The Lind documentation is currently under heavy construction. Please submit an issue, if something doesn't seem right or is missing. More detailed usage guides will follow soon!