Note: this project has fulfilled its PoC purpose. Please refer to here for a production grade attempt leveraging the same idea here.
This project generates a runtime environment for native code generated by WAVM. See this issue for more details.
One main use case for this, is to support WASM code in Nervos CKB. Hence you will see CKB VM related code, however we do also provide a POSIX ABI so you can compile native code.
$ export TOP=$(pwd)
$ git clone https://github.com/WAVM/WAVM
$ cd WAVM
$ mkdir -p build
$ cd bulid
# Please modify the path if you install LLVM to a different location
$ cmake .. -DLLVM_DIR=/usr/lib/llvm-9/lib/cmake/llvm
$ make
$ ./bin/wavm compile --format=precompiled-wasm ../Examples/helloworld.wast helloworld.precompiled.x86.wasm
$ cd $TOP
$ git clone https://github.com/xxuejie/wavm-aot-generator
$ cd wavm-aot-generator
$ cargo build --release
$ ./target/release/wavm-aot-generator ../WAVM/build/helloworld.precompiled.x86.wasm helloworld_x86
$ cat << EOF > dummy.c
#include "helloworld_x86_glue.h"
#include "abi/posix_wasi_abi.h"
EOF
$ gcc -g -o helloworld.riscv64 helloworld_x86.o dummy.c
$ ./helloworld.x86
Hello World!