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
Родитель 0d86246c8c
Коммит 0ab8b21981
3 изменённых файлов: 13 добавлений и 19 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,18 +1,11 @@
#!/bin/bash
set -x -e -v
# This script is for building libc-wasi.
cd $GECKO_PATH
# gets a bit too verbose here
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
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 $MOZ_FETCHES_DIR/wasi-sdk
PREFIX=$MOZ_FETCHES_DIR/wasi-sdk/wasi-sysroot
make PREFIX=$PREFIX
# Put a tarball in the artifacts 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