Setup your C/C++ environment

To build C applications that use the Wasmer runtime as a host for guest Wasm modules, you will need a C compiler installed (clang or gcc, for example). Check the compiler installation instructions here.

Download our SDK for the C-API from Wasmer releases page. Depending on your system, you will need to download:

  • Linux: wasmer-c-api-linux-amd64.tar.gz

  • macOS: wasmer-c-api-darwin-amd64.tar.gz

  • Windows: wasmer-c-api-windows.tar.gz

Once you have downloaded the c-api file, you can now extract its contents and set the WASMER_C_API environment variable to the path of the wasmer-c-api directory (this will be very useful when running the examples):

# Extract the contents to a dir
mkdir wasmer-c-api
tar -C wasmer-c-api -zxvf wasmer-c-api*.tar.gz
export WASMER_C_API=`pwd`/wasmer-c-api
# Update LD_LIBRARY_PATH to link against the in the examples
export LD_LIBRARY_PATH=`pwd`/wasmer-c-api/lib/:$LD_LIBRARY_PATH

Note: You can also build the C-API from source.

Installing Clang/GCC

First, you can test if clang or gcc is installed already by running:

gcc --version

If this command does not return the version, then see the following:


gcc / clang is usually installed by default. However, if it is not, you can install gcc/clang by installing xcode-select on your mac.

Debian / Debian Based / Linux

To install gcc on a Debian based, you will want to run the following:

sudo apt-get install build-essential

Gcc should be installable on your favorite linux distro as well. Please search for the correct command for your desired distribution.


To install gcc on Windows, you will probably want to install a GNU environment on windows. We suggest using MinGW.

gcc --version
# This should output: "LICENSE include lib"

If these commands work, The compiler and the Wasmer C API are successfully installed!

Next, let's take a look at building a simple Hello World Example!