12add0d91Sopenharmony_ciFROM ubuntu:22.04 22add0d91Sopenharmony_ci 32add0d91Sopenharmony_ciRUN apt-get update && \ 42add0d91Sopenharmony_ci apt-get install -y --no-install-recommends \ 52add0d91Sopenharmony_ci ca-certificates \ 62add0d91Sopenharmony_ci clang \ 72add0d91Sopenharmony_ci curl \ 82add0d91Sopenharmony_ci git \ 92add0d91Sopenharmony_ci libc6-dev \ 102add0d91Sopenharmony_ci make \ 112add0d91Sopenharmony_ci xz-utils 122add0d91Sopenharmony_ci 132add0d91Sopenharmony_ci# Note that we're using `git reset --hard` to pin to a specific commit for 142add0d91Sopenharmony_ci# verification for now. The sysroot is currently in somewhat of a state of flux 152add0d91Sopenharmony_ci# and is expected to have breaking changes, so this is an attempt to mitigate 162add0d91Sopenharmony_ci# those breaking changes on `libc`'s own CI 172add0d91Sopenharmony_ciRUN git clone https://github.com/WebAssembly/wasi-libc && \ 182add0d91Sopenharmony_ci cd wasi-libc && \ 192add0d91Sopenharmony_ci git reset --hard ad5133410f66b93a2381db5b542aad5e0964db96 202add0d91Sopenharmony_ciRUN apt-get install -y --no-install-recommends llvm 212add0d91Sopenharmony_ciRUN make -C wasi-libc install -j $(nproc) INSTALL_DIR=/wasi-libc 222add0d91Sopenharmony_ci 232add0d91Sopenharmony_ciRUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | \ 242add0d91Sopenharmony_ci tar xJf - 252add0d91Sopenharmony_ciENV PATH=$PATH:/wasmtime-dev-x86_64-linux 262add0d91Sopenharmony_ciCOPY docker/wasm32-wasi/clang.sh /wasi-libc/bin/clang 272add0d91Sopenharmony_ci 282add0d91Sopenharmony_ciRUN apt-get install -y --no-install-recommends lld 292add0d91Sopenharmony_ciRUN ln -s /usr/bin/wasm-ld-10 /usr/bin/wasm-ld 302add0d91Sopenharmony_ciENV PATH=$PATH:/usr/lib/llvm-10/bin 312add0d91Sopenharmony_ci 322add0d91Sopenharmony_ci# Of note here is our clang wrapper which just executes a normal clang 332add0d91Sopenharmony_ci# executable with the right sysroot, and then we're sure to turn off the 342add0d91Sopenharmony_ci# crt-static feature to ensure that the CRT that we're specifying with `clang` 352add0d91Sopenharmony_ci# is used. 362add0d91Sopenharmony_ciENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \ 372add0d91Sopenharmony_ci CARGO_TARGET_WASM32_WASI_LINKER=/wasi-libc/bin/clang \ 382add0d91Sopenharmony_ci CC_wasm32_wasi=/wasi-libc/bin/clang \ 392add0d91Sopenharmony_ci PATH=$PATH:/rust/bin \ 402add0d91Sopenharmony_ci RUSTFLAGS=-Ctarget-feature=-crt-static 41