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-wasip1
Install wasm-tools
cargo install --force --locked wasm-tools@1.223.0
Confirm the installation:
wasm-tools --version
wasm-tools 1.223.0
Install wit-bindgen
cargo install --force --locked wit-bindgen-cli@0.37.0
Confirm the installation:
wit-bindgen --version
wit-bindgen-cli 0.37.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 WASI SDK 25.0
Download and extract WASI SDK 25.0 (opens in a new tab) somewhere. In the examples we assume that the WASI_SDK_PATH
environment variable is set up pointing to the extracted SDK.
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.