Setup development environment for C/C++
To write Golem components in C or C++, a couple of common WebAssembly tools need to be installed, as well as the latest version of the WASM SDK.
Install WebAssembly tooling
First of all, to install wasm-tools
via cargo
, you need to install the latest stable version of Rust. The recommended way to do so is using https://rustup.rs (opens in a new tab):
Install Rust
Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install the latest stable version of Rust
rustup install stable && rustup default stable
Add the WASI target
rustup target add wasm32-wasi
Install wasm-tools
cargo install --force --locked wasm-tools@1.210.0
Confirm the installation:
wasm-tools --version
wasm-tools 1.210.0
Install wit-bindgen
cargo install --force --locked wit-bindgen-cli@0.26.0
Confirm the installation:
wit-bindgen --version
wit-bindgen-cli 0.26.0
Golem requires a specific version of wasm-tools
and wit-bindgen
. Please make sure the
correct version is installed with the commands described above.
Install WASM SDK 23.0
Download and extract WASI SDK 23.0 (opens in a new tab) somewhere - in the examples we assume it is put in ~/wasi-sdk-23.0
.
The SDK contains a version of Clang
that can compile to WebAssembly modules, which can be converted into Golem components using the wit-bindgen
and wasm-tools
command line tools.