Skip to content

Commit 27e7e16

Browse files
authored
Upgrade toolkits (#1878)
Upgrade the version of related toolkits: - upgrade llvm to 15.0 - upgrade wasi-sdk to 19.0 - upgrade emsdk to 3.1.28 - upgrade wabt to 1.0.31 - upgrade binaryen to 111 And upgrade the CI scripts, sample workload build scripts, Dockerfiles, and documents.
1 parent 1614ce1 commit 27e7e16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+817
-594
lines changed

.devcontainer/Dockerfile

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,23 @@ ENV TZ=Asian/Shanghai
1212
# hadolint ignore=DL3008
1313
RUN apt-get update \
1414
&& apt-get install -y apt-transport-https apt-utils build-essential \
15-
ca-certificates curl g++-multilib git gnupg \
15+
ca-certificates ccache curl g++-multilib git gnupg \
1616
libgcc-9-dev lib32gcc-9-dev lsb-release \
1717
ninja-build ocaml ocamlbuild python2.7 \
1818
software-properties-common tree tzdata \
1919
unzip valgrind vim wget zip --no-install-recommends \
2020
&& apt-get clean -y \
2121
&& rm -rf /var/lib/apt/lists/*
2222

23+
#
24+
# binaryen
25+
ARG BINARYEN_VER=111
26+
WORKDIR /opt
27+
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VER}/binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
28+
&& tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
29+
&& ln -sf /opt/binaryen-version_111 /opt/binaryen \
30+
&& rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz
31+
2332
#
2433
# CMAKE (https://apt.kitware.com/)
2534
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@@ -31,55 +40,56 @@ RUN wget --progress=dot:giga -O - https://apt.kitware.com/keys/kitware-archive-l
3140
&& apt-get install -y kitware-archive-keyring --no-install-recommends \
3241
&& apt-get install -y cmake --no-install-recommends \
3342
&& apt-get clean -y \
34-
&& rm -rf /var/lib/apt/lists/*
43+
&& rm -rf /var/lib/apt/lists/*
3544

3645
#
3746
# install emsdk
3847
WORKDIR /opt
3948
RUN git clone https://github.com/emscripten-core/emsdk.git
4049

50+
ARG EMSDK_VER=3.0.0
4151
WORKDIR /opt/emsdk
4252
RUN git pull \
43-
&& ./emsdk install 2.0.26 \
44-
&& ./emsdk activate 2.0.26 \
53+
&& ./emsdk install ${EMSDK_VER} \
54+
&& ./emsdk activate ${EMSDK_VER} \
4555
&& echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
4656

4757
#
4858
# install wasi-sdk
49-
ARG WASI_SDK_VER=16
59+
ARG WASI_SDK_VER=19
5060
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \
5161
&& tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
52-
&& ln -fs /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
62+
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
5363
&& rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
5464

5565
#
5666
#install wabt
5767
ARG WABT_VER=1.0.29
5868
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
5969
&& tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
60-
&& ln -fs /opt/wabt-${WABT_VER} /opt/wabt \
70+
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt \
6171
&& rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
6272

6373
#
6474
# install bazelisk
6575
ARG BAZELISK_VER=1.12.0
66-
RUN mkdir /opt/bazelisk \
76+
RUN mkdir /opt/bazelisk \
6777
&& wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
6878
&& chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
6979
&& ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
7080

7181
#
7282
# install clang+llvm
83+
ARG LLVM_VER=14
84+
RUN apt-get purge -y clang-10 llvm-10 && apt autoremove -y
7385
WORKDIR /etc/apt/apt.conf.d
7486
RUN touch 99verfiy-peer.conf \
7587
&& echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
7688

77-
WORKDIR /tmp
89+
WORKDIR /tmp
7890
RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
7991
&& chmod a+x ./llvm.sh \
80-
&& /tmp/llvm.sh 12 all \
81-
&& ln -sf /usr/bin/clang-format-12 /usr/bin/clang-format \
82-
&& rm -rf /tmp/*
92+
&& ./llvm.sh ${LLVM_VER} all
8393

8494
#
8595
# [Optional]
@@ -96,17 +106,28 @@ RUN apt-get update \
96106
# Install required python packages
97107
# hadolint ignore=DL3013
98108
RUN python3 -m pip install --no-cache-dir --upgrade pip \
99-
&& pip3 install --no-cache-dir --user black nose pycparser pylint
109+
&& pip3 install --no-cache-dir black nose pycparser pylint
110+
111+
#
112+
# Install github-cli. It doens't work as a feature of devcontainer.json
113+
RUN cd /tmp \
114+
&& wget https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_linux_amd64.deb \
115+
&& dpkg -i gh_2.20.2_linux_amd64.deb
100116

101-
# set path, PS and clean up
102-
ENV PATH "/opt/bazelisk:/opt/clang-llvm/bin:${PATH}"
103-
RUN echo "export PATH=/opt/bazelisk:/opt/clang-llvm/bin:${PATH}" >> /root/.bashrc \
104-
&& printf "%s\n" "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc \
117+
#
118+
# Install NodeJS
119+
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
120+
RUN apt-get install -y nodejs
121+
122+
# set path
123+
ENV PATH="/opt/bazelisk:/usr/lib/llvm-${LLVM_VER}/bin:${PATH}"
124+
ENV CC=/usr/lib/llvm-${LLVM_VER}/bin/clang CXX=/usr/lib/llvm-${LLVM_VER}/bin/clang++
125+
RUN printf "%s\n" "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc \
105126
&& apt-get autoremove -y \
106127
&& apt-get clean -y \
107128
&& rm -rf /var/lib/apt/lists/* \
108129
&& rm -rf /tmp/*
109130

110131
# set workdir when container run
111-
VOLUME /workspace
112-
WORKDIR /workspace
132+
VOLUME /workspaces
133+
WORKDIR /workspaces

.devcontainer/devcontainer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright (C) 2019 Intel Corporation. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3-
43
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
54
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp
65
{
@@ -10,7 +9,12 @@
109
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
1110
// Use Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
1211
"args": {
13-
"VARIANT": "ubuntu-20.04"
12+
"BINARYEN_VER": "111",
13+
"EMSDK_VER": "3.0.0",
14+
"LLVM_VER": "15",
15+
"VARIANT": "ubuntu-20.04",
16+
"WASI_SDK_VER": "19",
17+
"WABT_VER": "1.0.31"
1418
}
1519
},
1620
"runArgs": [
@@ -27,12 +31,10 @@
2731
// Add the IDs of extensions you want installed when the container is created.
2832
"extensions": [
2933
"dtsvet.vscode-wasm",
30-
"esbenp.prettier-vscode",
34+
"llvm-vs-code-extensions.vscode-clangd",
3135
"ms-python.python",
3236
"ms-python.vscode-pylance",
3337
"ms-vscode.cmake-tools",
34-
"ms-vscode.cpptools",
35-
"twxs.cmake"
3638
]
3739
}
3840
},

.github/workflows/build_llvm_libraries.yml

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,42 @@ name: Reusable workflow-build_llvm_libraries
55
on:
66
workflow_call:
77
inputs:
8-
runs-on:
8+
os:
99
required: true
1010
type: string
11+
arch:
12+
required: true
13+
type: string
14+
outputs:
15+
cache_key:
16+
description: "A cached key of LLVM libraries"
17+
value: ${{ jobs.build_llvm_libraries.outputs.key}}
1118

1219
jobs:
1320
build_llvm_libraries:
14-
runs-on: ${{ matrix.os }}
15-
strategy:
16-
matrix:
17-
os: ${{ fromJson(inputs.runs-on) }}
21+
runs-on: ${{ inputs.os }}
22+
outputs:
23+
key: ${{ steps.create_lib_cache_key.outputs.key}}
1824

1925
steps:
2026
- name: checkout
2127
uses: actions/checkout@v3
2228

29+
- name: retrive the last commit ID
30+
id: get_last_commit
31+
run: echo "last_commit=$(/usr/bin/env python3 ./build_llvm.py --llvm-ver)" >> $GITHUB_OUTPUT
32+
working-directory: build-scripts
33+
34+
# Bump the prefix number to evict all previous caches and
35+
# enforce a clean build, in the unlikely case that some
36+
# weird build error occur and llvm/build becomes a potential
37+
# suspect.
38+
- name: form the cache key of libraries
39+
id: create_lib_cache_key
40+
run: echo "key=0-llvm-libraries-${{ inputs.os }}-${{ inputs.arch }}-${{ steps.get_last_commit.outputs.last_commit }}" >> $GITHUB_OUTPUT
41+
2342
- name: Cache LLVM libraries
24-
id: cache_llvm
43+
id: retrieve_llvm_libs
2544
uses: actions/cache@v3
2645
with:
2746
path: |
@@ -30,10 +49,39 @@ jobs:
3049
./core/deps/llvm/build/lib
3150
./core/deps/llvm/build/libexec
3251
./core/deps/llvm/build/share
33-
key: ${{ matrix.os }}-build-llvm_libraries_ex
52+
key: ${{ steps.create_lib_cache_key.outputs.key}}
53+
54+
- uses: actions/cache@v3
55+
with:
56+
path: ~/.ccache
57+
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
58+
restore-keys: |
59+
0-ccache-${{ inputs.os }}
60+
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-20.04'
61+
62+
- uses: actions/cache@v3
63+
with:
64+
path: ~/.cache/ccache
65+
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
66+
restore-keys: |
67+
0-ccache-${{ inputs.os }}
68+
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-22.04'
69+
70+
- run: sudo apt install -y ccache ninja-build
71+
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'ubuntu')
72+
73+
- uses: actions/cache@v3
74+
with:
75+
path: ~/Library/Caches/ccache
76+
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
77+
restore-keys: |
78+
0-ccache-${{ inputs.os }}
79+
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
80+
81+
- run: brew install ccache ninja
82+
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
3483

35-
- name: Build llvm
36-
id: build_llvm
37-
if: ${{ steps.cache_llvm.outputs.cache-hit != 'true' }}
38-
run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly
84+
- name: Build LLVM libraries
85+
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
86+
run: /usr/bin/env python3 ./build_llvm.py --arch ${{ inputs.arch }}
3987
working-directory: build-scripts

0 commit comments

Comments
 (0)