# Building SWI-Prolog using Emscripten for WebAssembly (WASM) As of version 8.1.2, building an executable for WASM is fully supported by the standard build process. The port is the work of Raivo Laanemets and related material can be found mostly on his [GitHub pages](https://github.com/). ## Preparation You need to download the Emscripten compiler. Follow the instruction on its [homepage](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). After the successful installation load the Emscripten environment into the current terminal session (adjust path): source ./emsdk_env.sh ## Dependencies SWI-Prolog depends on zlib. To compile it to WebAssembly: wget https://zlib.net/zlib-1.2.11.tar.gz -O "$HOME/zlib-1.2.11.tar.gz" tar -xf "$HOME/zlib-1.2.11.tar.gz" -C "$HOME" cd "$HOME/zlib-1.2.11" emconfigure ./configure emmake make This will download and build zlib into the zlib-1.2.11 subdirectory in your home directory. ## Building See [CMAKE.md](https://github.com/SWI-Prolog/swipl-devel/blob/master/CMAKE.md) in the top directory of the sources. @see https://github.com/SWI-Prolog/swipl-wasm