TIDE
Languages

Wasmtime

Installing Wasmtime WebAssembly runtime on Ubuntu in TIDE

Wasmtime

Wasmtime is a standalone, high-performance WebAssembly (Wasm) runtime developed by the Bytecode Alliance, supporting WASI (WebAssembly System Interface).

Installation

Official Installation Script

Install Wasmtime using the official installation script:

curl https://wasmtime.dev/install.sh -sSf | bash

Reload your environment:

source ~/.bashrc

Installing via Cargo

Alternatively, if Rust and Cargo are installed:

cargo install wasmtime-cli

Verification

Check that Wasmtime is installed:

wasmtime --version

Writing and Running WebAssembly Code

WebAssembly binaries (.wasm) or text representations (.wat) can be executed using Wasmtime.

Create a file named hello.wat:

hello.wat
(module
  (import "wasi_snapshot_preview1" "proc_exit" (func $proc_exit (param i32)))
  (memory (export "memory") 1)
  (data (i32.const 0) "Hello, World from Wasmtime!\n")
  (func (export "_start")
    i32.const 0
    call $proc_exit
  )
)

Run the WebAssembly text file directly with Wasmtime:

wasmtime run hello.wat

Official Resources

On this page