The ssvmup tool

• 2 minutes to read

Throughout our examples, we make extensive use of the ssvmup tool. It is inspired by the wasm-pack project but is optimized for server-side applications. Specifically, it supports the SSVM WebAssembly virtual machine and Deno host runtime.

The ssvmup uses wasm-bindgen to automatically generate the “glue” code between JavaScript and Rust source code so that they can communicate using their native data types. Without it, the function arguments and return values would be limited to very simple types (i.e., 32-bit integers) supported natively by WebAssembly. For example, strings or arrays would not be possible without ssvmup and wasm-bindgen.


The ssvmup depends on the Rust cargo toolchain to compile Rust source code to WebAssembly. You must have Rust installed on your machine.

$ curl --proto '=https' --tlsv1.2 -sSf | sh
$ source $HOME/.cargo/env


The easiest way to install ssvmup is to use its installer.

$ curl -sSf | sh

Alternatively, you can install using the NPM if you'd like.


To build Rust functions for Node.js applications, use the following command. See a template application.

$ ssvmup build

Use the --enable-ext flag to compile Rust programs that use WASI extensions, such as SSVM's storage, native command and tensorflow APIs. The ssvmup will run the compiled WebAssembly bytecode program in the ssvm-extensions Node.js module instead of plain ssvm in this case.

$ ssvmup build --enable-ext

To build Rust functions for Deno applications, use the following command. See a template application.

$ ssvmup build --target deno

Support AOT

A key feature of the SSVM is its support for Ahead-of-Time (AOT) compilers. When you run WebAssembly programs in Node.js ssvm and ssvm-extensions add-ons, you typically do not need to worry about it as the add-on handles AOT compilation transparently. However, in some cases, you do want the ssvmup to compile and generate native code for the program. An example is the Tensorflow as a Service template for Tencent Cloud.

Then, use the commands below to bring your operating system up to date with the latest developer tools. The commands here are tested on Ubuntu 20.04.

$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt install build-essential curl wget git vim libboost-all-dev llvm-dev liblld-10-dev

Now, you can build the .so files for the AOT native target like the following.

$ ssvmup build --enable-aot

Enjoy coding!

Fast, safe, portable and serverless Rust functions as services