WASI-enabled WebAssembly C/C++ toolchain
  • C 35.5%
  • Shell 28.4%
  • Makefile 27.5%
  • CMake 3.5%
  • Dockerfile 2.7%
  • Other 2.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2021-11-08 15:02:44 +03:00
.github/workflows manual dispatch for build 2021-06-28 19:03:03 +03:00
cmake/Platform Update how wasi-sdk uses cmake (#161) 2020-11-30 19:44:16 -08:00
src removed unsupported code from libcxx and libc 2021-11-08 15:02:44 +03:00
tests Test signals (#140) 2020-06-03 15:04:09 -07:00
.dockerignore Add .dockerignore file (#63) 2019-10-11 11:36:37 -07:00
.gitignore Fix windows SDK builds (#126) 2020-04-20 13:56:47 -07:00
.gitmodules switched to beammw forks 2021-11-08 09:51:54 +03:00
CODE_OF_CONDUCT.md Add a CODE_OF_CONDUCT.md file. 2019-10-06 13:10:42 -07:00
deb_from_installation.sh fix deb build (#167) 2020-12-02 14:50:43 -08:00
docker_build.sh produce deb and tars 2019-03-06 17:04:38 -08:00
Dockerfile use llvm 12.0.0 release (#178) 2021-04-20 10:32:41 -07:00
LICENSE Add a LICENSE file, "Apache-2.0 WITH LLVM-exception". (#100) 2020-02-20 10:16:52 +01:00
llvm_version.sh Allow llvm-project path change; version from llvm-config. 2019-04-05 08:27:05 -07:00
Makefile Add missing dependency between compiler-rt and wasi-libc (#189) 2021-08-11 14:19:58 -07:00
README.md Autoconf 2.70 shipped WASI support (#193) 2021-09-27 21:48:04 -07:00
strip_symbols.sh Fix strip_symbols.sh on mac; bump libc to include utime.h (#116) 2020-04-06 20:06:38 -07:00
tar_from_installation.sh Fix windows SDK builds (#126) 2020-04-20 13:56:47 -07:00
version.sh build system fixups 2019-03-06 11:44:11 -08:00
wasi-sdk.cmake Update how wasi-sdk uses cmake (#161) 2020-11-30 19:44:16 -08:00
wasi-sdk.control initial commit 2019-03-06 11:18:21 -08:00

WASI SDK

Quick Start

Download SDK packages here.

About this repository

This repository contains no compiler or library code itself; it uses git submodules to pull in the upstream Clang and LLVM tree, as well as the wasi-libc tree.

The libc portion of this SDK is the wasi-libc.

Upstream Clang and LLVM (from 9.0 onwards) can compile for WASI out of the box, and WebAssembly support is included in them by default. So, all that's done here is to provide builds configured to set the default target and sysroot for convenience.

One could also use a standard Clang installation, build a sysroot from the sources mentioned above, and compile with "--target=wasm32-wasi --sysroot=/path/to/sysroot".

Install

A typical installation from the release binaries might look like the following:

export WASI_VERSION=12
export WASI_VERSION_FULL=${WASI_VERSION}.0
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz

Use

Use the clang installed in the wasi-sdk directory:

export WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_VERSION_FULL}
CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"
$CC foo.c -o foo.wasm

Note: ${WASI_SDK_PATH}/share/wasi-sysroot contains the WASI-specific includes/libraries/etc. The --sysroot=... option is not necessary if WASI_SDK_PATH is /opt/wasi-sdk.

Notes for Autoconf

Autoconf 2.70 now recognizes WASI.

For convenience when building packages that aren't yet updated, updated config.sub and config.guess files are installed at share/misc/config.* in the install directory.

Notable Limitations

This repository does not yet support C++ exceptions. C++ code is supported only with -fno-exceptions for now. Similarly, there is not yet support for setjmp/longjmp. Work on support for exception handling s underway at the language level which will support both of these features.

This repository does not yet support threads. Specifically, WASI does not yet have an API for creating and managing threads yet, and WASI libc does not yet have pthread support.

This repository does not yet support dynamic libraries. While there are some efforts to design a system for dynamic libraries in wasm, it is still in development and not yet generally usable.

There is no support for networking. It is a goal of WASI to support networking in the future though.