Last updated
Last updated
Building Wasmer from source requires 1.45+.
The easiest way to install Rust on your system is via Rustup. To get Rustup on Linux and macOS, you can run the following:
To install Rust on Windows, download and run , then follow the onscreen instructions.
Windows support is fully supported. WASI is fully supported, but Emscripten support is in the works.
Install
Install
Install . Allow it to add git.exe
to your PATH (default settings for the installer are fine).
(optional) Install
Wasmer is built with , the Rust package manager.
First, let's clone Wasmer:
Wasmer supports three different compilers at the moment:
Build Wasmer:
Note: you should see this as the first line in the console:
Available compilers: singlepass
The Cranelift compiler will work if you are in a X86 or ARM machine, so you don't need to do anything in your system to enable it.
Note: should see this as the first line in the console:
Available compilers: cranelift
If you want support for the Wasmer LLVM compiler, then you will also need to ensure:
Ensure that LLVM 10.0.x > is installed on your system
In case llvm-config
is not accessible, set the correct environment variable for LLVM to access: For example, the environment variable for LLVM 10.0.x would be: LLVM_SYS_100_PREFIX=/path/to/unpacked/llvm-10.0
And create a Wasmer release
Note: you should see this as the first line in the console:
Available compilers: llvm
Once you have LLVM and Rust, you can just run:
Note: you should see this as the first line in the console:
Available compilers: singlepass cranelift llvm
Once you run the make build-wasmer
command, you will have a new binary ready to be used!
However, you can also compile the shared library from source:
This will generate the shared library (depending on your system):
Windows: package/release/libwasmer_c_api.dll
macOS: target/release/libwasmer_runtime_c_api.dylib
Linux: target/release/libwasmer_runtime_c_api.so
If you want to generate the library and headers for using them easily, you can execute:
By default, the Wasmer C API shared library is built with Cranelift as the default compiler and JIT engine. You can generate the C-API for a specific compiler and engine with:
Singlepass:
JIT: make build-capi-singlepass-jit
Native Engine: not yet available ⚠️
Cranelift:
JIT: make build-capi-cranelift-jit
Native Engine: make build-capi-cranelift-native
LLVM: make build-capi-llvm
JIT: make build-capi-llvm-jit
Native Engine: make build-capi-llvm-native
You can also
Wasmer provides a pre-compiled version for the C-API on its .
This command will generate a package
directory, that you can then use easily in the .