Building the Source

Source for tiny-wasm-runtime

The source can be found at:

The main branch contains the latest release. The dev branch is work in progress.

Tools needed

You will need these core tools:

  • NPM - package manager
  • Typescript
  • clang tool chain - for C/C++ code
  • wasm-ld - to link the .wasm files
  • wat2wasm - to compile web assembly (.wat) files of which I have a few
  • GNU make
  • git - to clone tiny-wasm-runtime source, or to clone llvm, if you want to build libc++

In addition, you might need:

  • VS Code - to use the debug launcher and build tasks
  • Parcel v2 - to bundle the examples
  • mkdocs - to build the documentation static web site
  • python - mkdocs is built with python, and you need python to run in examples
  • CMake and ninja - to build llvm libc++

There is a deprecated gcc build that I used to use for testing, but now the tests are executed in wasm.

To Build the Libraries (lib-c, lib-js)

cd source

or on windows

cd source

To Build the Examples

See examples/ for more information.

To build the examples, but not bundle them.

cd examples

To build bundles:


To Build the docs

In tiny-wasm-runtime root folder:

mkdocs build

The destination of the build is found in the mkdocs.yml file (site_dir: azure/docsite/).

Usually the docs are built as part of building the static web site that hosts the docs and examples. This is accomplished using this shell script (found in examples folder):

To Build libc++ for wasm and tiny-wasm-runtime

See the instructions in the comments in the shell script source\libcxx\

Installing clang and wasm-ld on Windows

Here is how I installed the tools for windows:

 install  MSYS2 
   2. After the install completes, run UCRT64 terminal by clicking on the MSYS2 UCRT64 in the Start menu
   3. pacman -Syuu

 install gcc using MSYS2 UCRT64
   1. Use MSYS2 UCRT64 terminal (per above)
   1. pacman -S mingw-w64-ucrt-x86_64-toolchain

 install clang and wasm-ld using MSYS2 UCRT64
   2. Use MSYS2 UCRT64  (per above)
      1. pacman -S mingw-w64-ucrt-x86_64-clang
      2. pacman -S mingw-w64-x86_64-lld

update PATH env variable using the windows control panel (search for path)
   2. added C:\msys64\ucrt64\bin 
   3. added C:\msys64\mingw64\bin 
   4. added C:\msys64\usr\bin (for sh.exe used by mingw32-make)

wabt tools: can be found here