1FROM ubuntu:22.04 2 3RUN apt-get update && \ 4 apt-get install -y --no-install-recommends \ 5 ca-certificates \ 6 clang \ 7 curl \ 8 git \ 9 libc6-dev \ 10 make \ 11 xz-utils 12 13# Note that we're using `git reset --hard` to pin to a specific commit for 14# verification for now. The sysroot is currently in somewhat of a state of flux 15# and is expected to have breaking changes, so this is an attempt to mitigate 16# those breaking changes on `libc`'s own CI 17RUN git clone https://github.com/WebAssembly/wasi-libc && \ 18 cd wasi-libc && \ 19 git reset --hard ad5133410f66b93a2381db5b542aad5e0964db96 20RUN apt-get install -y --no-install-recommends llvm 21RUN make -C wasi-libc install -j $(nproc) INSTALL_DIR=/wasi-libc 22 23RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | \ 24 tar xJf - 25ENV PATH=$PATH:/wasmtime-dev-x86_64-linux 26COPY docker/wasm32-wasi/clang.sh /wasi-libc/bin/clang 27 28RUN apt-get install -y --no-install-recommends lld 29RUN ln -s /usr/bin/wasm-ld-10 /usr/bin/wasm-ld 30ENV PATH=$PATH:/usr/lib/llvm-10/bin 31 32# Of note here is our clang wrapper which just executes a normal clang 33# executable with the right sysroot, and then we're sure to turn off the 34# crt-static feature to ensure that the CRT that we're specifying with `clang` 35# is used. 36ENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \ 37 CARGO_TARGET_WASM32_WASI_LINKER=/wasi-libc/bin/clang \ 38 CC_wasm32_wasi=/wasi-libc/bin/clang \ 39 PATH=$PATH:/rust/bin \ 40 RUSTFLAGS=-Ctarget-feature=-crt-static 41