Update build scripts and documents of workload samples for wasi-sdk-12.0 (#484)

Update the build scripts of sample workloads (meshoptimizer/bwa/wasm-av1) to use the wasi-sdk-12.0 firstly to build the workload and discard clang-11, as wasi-sdk-12 supports wasi, simd and pthread better. And update the related documents.
Also modify wasm mini loader to sync up with the change of wasm normal loader.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2020-12-29 00:41:09 -06:00
committed by GitHub
parent 724858c731
commit 365ec6360b
16 changed files with 227 additions and 283 deletions

View File

@ -1,29 +1,32 @@
FROM ubuntu:18.04 as builder
RUN apt update \
&& apt install -y lsb-release software-properties-common build-essential \
wget curl git tree zip unzip
#
# install clang and llvm
COPY llvm.sh /tmp
RUN apt update \
&& apt install -y lsb-release wget software-properties-common build-essential \
&& cd /tmp \
&& chmod a+x llvm.sh \
&& ./llvm.sh 11
# COPY llvm.sh /tmp
# RUN apt update \
# && apt install -y lsb-release wget software-properties-common build-essential \
# && cd /tmp \
# && chmod a+x llvm.sh \
# && ./llvm.sh 11
ARG WASI_SDK_VER=11.0
ARG WABT_VER=1.0.19
ARG WASI_SDK_VER=12
ARG WABT_VER=1.0.20
ARG CMAKE_VER=3.16.2
ARG BINARYEN_VER=version_97
ARG BAZEL_VER=3.7.0
#
# install wasi-sdk
ARG WASI_SDK_FILE="wasi-sdk-${WASI_SDK_VER}-linux.tar.gz"
ARG WASI_SDK_FILE="wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz"
COPY ${WASI_SDK_FILE} /opt
RUN cd /opt \
&& tar zxf ${WASI_SDK_FILE} \
&& rm ${WASI_SDK_FILE} \
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER} /opt/wasi-sdk \
&& ln -sf /opt/wasi-sdk/lib/clang/10.0.0/lib/wasi/ /usr/lib/llvm-11/lib/clang/11.0.1/lib/
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk
#
# install wabt
@ -44,11 +47,6 @@ RUN cd /tmp \
&& ./${CMAKE_FILE} --prefix=/opt/cmake --skip-license \
&& ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
#
# install tools
RUN apt update \
&& apt install -y git tree
#
# install emsdk
RUN cd /opt \
@ -68,15 +66,13 @@ RUN cd /opt \
&& rm ${BINARYEN_FILE} \
&& ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
RUN apt install -y unzip zip
#
# install bazel
ARG BAZEL_FILE=bazel-${BAZEL_VER}-installer-linux-x86_64.sh
COPY ${BAZEL_FILE} /tmp
RUN cd /tmp \
&& chmod a+x ${BAZEL_FILE} \
&& ./${BAZEL_FILE}
# #
# # install bazel
# ARG BAZEL_FILE=bazel-${BAZEL_VER}-installer-linux-x86_64.sh
# COPY ${BAZEL_FILE} /tmp
# RUN cd /tmp \
# && chmod a+x ${BAZEL_FILE} \
# && ./${BAZEL_FILE}
#
# Clean up

View File

@ -1,34 +1,32 @@
#!/usr/bin/env bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#!/bin/bash
BUILD_CONTENT="/tmp/build_content"
readonly BUILD_CONTENT="/tmp/build_content"
if [[ ! -d ${BUILD_CONTENT} ]]; then
mkdir ${BUILD_CONTENT}
fi
WASI_SDK_VER=11.0
WABT_VER=1.0.19
CMAKE_VER=3.16.2
BINARYEN_VER=version_97
BAZEL_VER=3.7.0
readonly WASI_SDK_VER=12
readonly WABT_VER=1.0.20
readonly CMAKE_VER=3.16.2
readonly BINARYEN_VER=version_97
readonly BAZEL_VER=3.7.0
cd ${BUILD_CONTENT}
if [[ ! -f wasi-sdk-${WASI_SDK_VER}-linux.tar.gz ]]; then
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-${WASI_SDK_VER}-linux.tar.gz
cd ${BUILD_CONTENT} || exit
if [[ ! -f wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz ]]; then
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
fi
if [[ ! -f wabt-${WABT_VER}-ubuntu.tar.gz ]]; then
wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz
fi
if [[ ! -f llvm.sh ]]; then
wget https://apt.llvm.org/llvm.sh
fi
# if [[ ! -f llvm.sh ]]; then
# wget https://apt.llvm.org/llvm.sh
# fi
if [[ ! -f cmake-${CMAKE_VER}-Linux-x86_64.sh ]]; then
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh
@ -41,30 +39,21 @@ fi
if [[ ! -f bazel-${BAZEL_VER}-installer-linux-x86_64.sh ]]; then
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/bazel-${BAZEL_VER}-installer-linux-x86_64.sh
fi
cd - > /dev/null
cd - > /dev/null || exit
DOCKERFILE_PATH=$(dirname $(realpath $0))
DOCKERFILE_PATH=$(dirname "$(realpath "$0")")
docker build \
--build-arg http_proxy=${http_proxy} \
--build-arg https_proxy=${https_proxy} \
--build-arg HTTP_PROXY=${http_proxy} \
--build-arg HTTPS_PROXY=${https_proxy} \
--build-arg WASI_SDK_VER=${WASI_SDK_VER} \
--build-arg WABT_VER=${WABT_VER} \
--build-arg CMAKE_VER=${CMAKE_VER} \
--build-arg BINARYEN_VER=${BINARYEN_VER} \
--build-arg BAZEL_VER=${BAZEL_VER} \
-t clang_env:0.1 -f ${DOCKERFILE_PATH}/Dockerfile ${BUILD_CONTENT}
-t clang_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT}
docker run --rm -it \
-e http_proxy=${http_proxy} \
-e https_proxy=${https_proxy} \
-e HTTP_PROXY=${http_proxy} \
-e HTTPS_PROXY=${htpps_proxy} \
--name workload_w_clang \
--mount type=bind,source=$(pwd),target=/data/project \
--mount type=bind,source=$(pwd)/../cmake,target=/data/cmake \
--mount type=bind,source="$(pwd)",target=/data/project \
-w /data/project \
clang_env:0.1 \
/bin/bash -c /build.sh