oluceps / c2wib

Compile bpf program to WebAssembly in browser with clang wasm bin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile to wasm in browser

This project based on emception, emscripten and LLVM.

output.mp4

Demo

https://demo.nyaw.xyz

Upload example and try compile in the browser.

Tested with:

Mozilla Firefox 115.0.2
Chromium 115.0.5790.110

Build

$ ./build.sh
$ pnpm build

build with docker

$  docker buildx build . -t ctwib_build
$  docker run \
    -it --rm \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v $(pwd):$(pwd) \
    -v $(pwd)/emception/build/emsdk_cache:/emception/emsdk/upstream/emscripten/cache \
    -u $(id -u):$(id -g) \
    $(id -G | tr ' ' '\n' | xargs -I{} echo --group-add {}) \
    ctwib_build:latest \
    bash -c "pushd $(pwd)/emception && ./build.sh && popd && pnpm build"

Serve

$ pnpm dev

License

MIT © 2023 eunomia-bpf

About

Compile bpf program to WebAssembly in browser with clang wasm bin

License:MIT License


Languages

Language:JavaScript 98.1%Language:Dockerfile 1.3%Language:Shell 0.6%