Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tamaroning/wanco
WebAssembly AOT compiler with cross-CPU checkpoint/restore support
https://github.com/tamaroning/wanco
Last synced: 19 days ago
JSON representation
WebAssembly AOT compiler with cross-CPU checkpoint/restore support
- Host: GitHub
- URL: https://github.com/tamaroning/wanco
- Owner: tamaroning
- License: other
- Created: 2024-06-20T12:37:52.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-10-29T09:05:07.000Z (2 months ago)
- Last Synced: 2024-10-29T10:56:52.207Z (2 months ago)
- Language: C++
- Homepage:
- Size: 7.95 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wanco 🐶
![plot](docs/assets/animal_dance_dog.png)
wanco is a WebAssembly AOT compiler which supports cross-platform (CPU and OS) Checkpoint/Restore functionalities. wanco is forked from [Wasker](https://github.com/mewz-project/wasker).
See [examples](./examples) for quick start.
## Build
Prerequisites:
- POSIX compliant OS (Linux, TODO: support macOS)
- CMake and C++ compiler
- Rust and Cargo
- LLVM 17
- Easiest way to install LLVM 17 is to use llvm.sh (Ubuntu/Debian)
- `bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"`
- `chmod +x llvm.sh`
- `./llvm.sh 17`
- protocol buffer
- Run `apt install libprotobuf-dev protobuf-compiler`
- Libunwind
- Run `apt install libunwind-dev`
- Libdwarf
- Run `apt install libdwarf-dev`First clone the project:
```sh
$ git clone [email protected]:tamaroning/wanco.git
$ cd wanco
```This project includes C++ projects and Rust projects.
To build the entire project, run the following commands.```sh
$ mkdir build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
```To install the compilers and runtime libraries, run the following commands:
```sh
$ sudo make install
```## Run
After building the project, you will find the `wanco` binary in the top of `build` directory.
Before compiling wasm modules, make sure to add clang to the PATH environment variable or to specify the path to clang or clang++ by using the `--clang-path` option. (clang/clang++ version 17 or later is required.)
If `--clang-path` is not set, `clang-17` is used by default.
To compile the hello-world example, run:
```sh
$ wanco examples/hello.wat -o hello
$ ./hello
Hello World!
```To show the help, run:
```sh
$ wanco --help
```For debugging, run the compiler with `RUST_LOG="debug" wanco `.
### Enable Checkpoint/Restore functionalities
Compile a WebAssembly file with C/R enabled and run it:
```sh
$ wanco --enable-cr demo/fib.wat
$ a.out
```While the process is running, you can trigger checkpoint by sending `SIGUSR1` signal from another teminal:
(The running process is automatically terminated and the snapshot file is created.)
```sh
$ pkill -10 a.out
```To restore the execution, run:
```sh
$ ./a.out --restore checkpoint.json
```Note: Snapshot files are named `checkpoint.json` or `checkpoint.pb` (binary format generated with protobuf).
### Compile and assemble only
If you do not want a generated object file to be linked with runtime libraries, specify the `-c` option when running the compiler:
LLVM assembly file (`.ll`) will be generated.```sh
$ wanco examples/hello.wat -c -o hello.ll
```After that, you can link it with the runtime library together by using clang
```
$ clang -flto -no-pie hello.ll /usr/local/lib/libwanco_rt.a /usr/local/lib/libwanco_wasi.a -o hello
```## Test
To test the compiler, run:
```sh
$ cargo test
```## Devcontainer
```
docker buildx build .```
## LICENSE
- benchmark/: See LICENSE files in each directory
- others: MIT (See [LICENSE](./LICENSE))