https://github.com/oluceps/c2wib
Compile bpf program to WebAssembly in browser with clang wasm bin
https://github.com/oluceps/c2wib
Last synced: about 1 year ago
JSON representation
Compile bpf program to WebAssembly in browser with clang wasm bin
- Host: GitHub
- URL: https://github.com/oluceps/c2wib
- Owner: oluceps
- License: mit
- Created: 2023-08-01T18:38:33.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-02T04:37:55.000Z (almost 3 years ago)
- Last Synced: 2025-03-29T08:45:56.611Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 7.18 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Compile to wasm in browser
This project based on [emception](https://github.com/jprendes/emception/tree/master), [emscripten](https://emscripten.org) and [LLVM](https://llvm.org/).
https://github.com/oluceps/c2wib/assets/35628088/00352953-104c-4a26-97d5-5e28b84db54d
# Demo
https://demo.nyaw.xyz
Upload [example](./examples/bootstrap) and try compile in the browser.
Tested with:
Mozilla Firefox 115.0.2
Chromium 115.0.5790.110
# Build
```console
$ ./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
```console
$ pnpm dev
```
# License
[MIT](./LICENSE) © 2023 eunomia-bpf