Fix some compile issues of samples (#690)

Fix compile errors of workloads due to emsdk version upgrade,
enable BUILD_TARGET auto set for some samples,
and call wasm_runtime_init_thread_env() for in thread routine which
was created by pthread_create but not runtime in spawn-thread sample.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-08-06 18:12:21 +08:00
committed by GitHub
parent 541f577164
commit 0db04e0b8f
23 changed files with 902 additions and 304 deletions

View File

@ -4,19 +4,10 @@ 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
ARG WASI_SDK_VER=12
ARG WABT_VER=1.0.20
ARG WABT_VER=1.0.23
ARG CMAKE_VER=3.16.2
ARG BINARYEN_VER=version_97
ARG BINARYEN_VER=version_101
#
# install wasi-sdk
@ -52,8 +43,8 @@ RUN cd /opt \
&& git clone https://github.com/emscripten-core/emsdk.git \
&& cd emsdk \
&& git pull \
&& ./emsdk install latest \
&& ./emsdk activate latest \
&& ./emsdk install 2.0.12 \
&& ./emsdk activate 2.0.12 \
&& echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
#
@ -73,6 +64,9 @@ RUN cd /opt/bazelisk/bin/ \
&& chmod a+x bazelisk \
&& ln -sf /opt/bazelisk/bin/bazelisk /usr/local/bin/bazel
RUN apt update \
&& apt install -y python2.7-minimal
#
# Clean up
RUN apt-get autoremove -y \

View File

@ -10,9 +10,9 @@ if [[ ! -d ${BUILD_CONTENT} ]]; then
fi
readonly WASI_SDK_VER=12
readonly WABT_VER=1.0.20
readonly WABT_VER=1.0.23
readonly CMAKE_VER=3.16.2
readonly BINARYEN_VER=version_97
readonly BINARYEN_VER=version_101
readonly BAZELISK_VER=1.7.5
cd ${BUILD_CONTENT} || exit
@ -24,10 +24,6 @@ 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 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
fi
@ -36,7 +32,7 @@ if [[ ! -f binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz ]]; then
wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz
fi
if [[ ! -f bazelisk-linux-amd64.sh ]]; then
if [[ ! -f bazelisk-linux-amd64 ]]; then
wget https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64
fi
cd - > /dev/null || exit
@ -48,10 +44,10 @@ docker build \
--build-arg WABT_VER=${WABT_VER} \
--build-arg CMAKE_VER=${CMAKE_VER} \
--build-arg BINARYEN_VER=${BINARYEN_VER} \
-t clang_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT} \
-t wamr_workload_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT} \
&& docker run --rm \
--name workload_w_clang \
--mount type=bind,source="$(pwd)",target=/data/project \
-w /data/project \
clang_env:0.1 \
wamr_workload_env:0.1 \
/bin/bash -c /build.sh