Bug 1596219 - Augment wasi sysroot from bug 1582192 with bits necessary to perform wasm builds r=froydnj

Build a full sysroot by downloading the `wasi-sdk` repo, which has `llvm-project` and `wasi-libc` as submodules. `wasi-sdk` builds a `clang` in a unique configuration (with `wasm32-wasi` as a default target) and uses that `clang` to build the rest of the pieces for the wasm sysroot.

In principle it should be possible to build the sysroot using our in-house automation-built `clang`, but I kept running into strange, hard-to-diagnose issues when I attempted that. If someone else is able to straighten out all the compilation issues, we could replace this script and stop pulling in `wasi-sdk` entirely, which would result in a build that takes much less time overall. Until then, this will have to do to unblock the rest of the wasm sandboxing work.

Differential Revision: https://phabricator.services.mozilla.com/D54560

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ricky Stewart 2019-11-26 13:27:39 +00:00
parent 0d86246c8c
commit 0ab8b21981
3 changed files with 13 additions and 19 deletions

View File

@ -415,12 +415,12 @@ clang-9:
repo: https://github.com/llvm/llvm-project repo: https://github.com/llvm/llvm-project
revision: 0399d5a9682b3cef71c653373e38890c63c4c365 revision: 0399d5a9682b3cef71c653373e38890c63c4c365
wasi-libc: wasi-sdk:
description: wasi-libc source code description: wasi-sdk source code
fetch: fetch:
type: git type: git
repo: https://github.com/CraneStation/wasi-libc repo: https://github.com/CraneStation/wasi-sdk
revision: c35f0f5dd64ad982bbad71f3e3a8942a1029c1e6 revision: 5225b05436ce57f01fe649f411f3ff701246628b
ninja: ninja:
description: ninja 1.9.0 description: ninja 1.9.0

View File

@ -168,9 +168,10 @@ wasi-sysroot:
toolchain-artifact: public/build/wasi-sysroot.tar.xz toolchain-artifact: public/build/wasi-sysroot.tar.xz
fetches: fetches:
fetch: fetch:
- wasi-libc - wasi-sdk
toolchain: toolchain:
- linux64-clang - linux64-binutils
- linux64-gcc-7
wrench-deps: wrench-deps:
description: "Downloads all the crates needed for building wrench" description: "Downloads all the crates needed for building wrench"

View File

@ -1,18 +1,11 @@
#!/bin/bash #!/bin/bash
set -x -e -v set -x -e -v
# This script is for building libc-wasi. export PATH="$MOZ_FETCHES_DIR/gcc/bin:$MOZ_FETCHES_DIR/binutils/bin:$PATH"
export LD_LIBRARY_PATH="$MOZ_FETCHES_DIR/gcc/lib64/:$LD_LIBRARY_PATH"
cd $GECKO_PATH cd $MOZ_FETCHES_DIR/wasi-sdk
PREFIX=$MOZ_FETCHES_DIR/wasi-sdk/wasi-sysroot
# gets a bit too verbose here make PREFIX=$PREFIX
cd $MOZ_FETCHES_DIR/wasi-libc
make WASM_CC=$MOZ_FETCHES_DIR/clang/bin/clang \
WASM_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-ar \
WASM_NM=$MOZ_FETCHES_DIR/clang/bin/llvm-nm \
SYSROOT=$(pwd)/wasi-sysroot
# Put a tarball in the artifacts dir # Put a tarball in the artifacts dir
mkdir -p $UPLOAD_DIR mkdir -p $UPLOAD_DIR
tar caf $UPLOAD_DIR/wasi-sysroot.tar.xz wasi-sysroot tar -C $MOZ_FETCHES_DIR/wasi-sdk/ -caf $UPLOAD_DIR/wasi-sysroot.tar.xz wasi-sysroot