forked from WebAssembly/wasi-libc
-
Notifications
You must be signed in to change notification settings - Fork 21
167 lines (151 loc) · 5.63 KB
/
build_cxx_sysroot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Build C/C++ Sysroot
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_call:
permissions:
contents: read
checks: write
jobs:
build_cxx_sysroot_eh:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
options: --user root --workdir /
steps:
- name: Update and install dependencies
run: |
pacman -Syu --noconfirm
pacman -Sy --noconfirm coreutils nodejs npm wget git cmake ninja llvm clang rsync make lld wasmer cargo python3
- name: Log tool versions
run: |
echo git
git --version
echo "##########################"
echo wasmer
wasmer -V
echo "##########################"
echo clang
clang -v
echo "##########################"
echo llvm-ar
llvm-ar -V
echo "##########################"
echo llvm-nm
llvm-nm -V
echo "##########################"
echo nodejs
node -v
echo "##########################"
echo npm
npm -v
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
run: |
git config --global --add safe.directory $(pwd)
./build32-eh.sh
rm -rf /opt/wasix-sysroot
cp -r sysroot /opt/wasix-sysroot
cp tools/clang-wasix-eh.cmake_toolchain /opt/wasix-sysroot/clang-wasix.cmake_toolchain
- name: Build and install compiler_rt builtins
run: |
mkdir -p build-compiler-rt-builtins
cd build-compiler-rt-builtins
cmake --fresh \
-DCOMPILER_RT_BAREMETAL_BUILD=On \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCOMPILER_RT_OS_DIR=wasm32-wasi \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=/opt/wasix-sysroot/clang-wasix.cmake_toolchain \
-DCMAKE_SYSROOT=/opt/wasix-sysroot \
-DCMAKE_INSTALL_PREFIX=/opt/wasix-sysroot \
../tools/llvm-project/compiler-rt/lib/builtins
cmake --build . --target install --parallel 4
llvm-ranlib /opt/wasix-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a
- name: Run WASIX tests
run: |
export CLANG_VERSION=$(clang --version | grep -i "clang version" | sed -n 's/.*version \([0-9.]*\).*/\1/p')
echo Detected clang version $CLANG_VERSION
mkdir -p /usr/lib/clang/19/lib/wasm32-wasmer-wasi
cp /opt/wasix-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a /usr/lib/clang/19/lib/wasm32-wasmer-wasi/libclang_rt.builtins.a
TOOLCHAIN=/opt/wasix-sysroot/clang-wasix.cmake_toolchain ./test/wasix/run_tests.sh
- name: Upload sysroot
uses: actions/upload-artifact@v4
with:
name: wasix-sysroot-eh
path: /opt/wasix-sysroot
build_cxx_sysroot:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
options: --user root --workdir /
steps:
- name: Update and install dependencies
run: |
pacman -Syu --noconfirm
pacman -Sy --noconfirm coreutils nodejs npm wget git cmake ninja llvm clang rsync make lld wasmer cargo python3
- name: Log tool versions
run: |
echo git
git --version
echo "##########################"
echo wasmer
wasmer -V
echo "##########################"
echo clang
clang -v
echo "##########################"
echo llvm-ar
llvm-ar -V
echo "##########################"
echo llvm-nm
llvm-nm -V
echo "##########################"
echo nodejs
node -v
echo "##########################"
echo npm
npm -v
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
run: |
git config --global --add safe.directory $(pwd)
./build32.sh
rm -rf /opt/wasix-sysroot
cp -r sysroot /opt/wasix-sysroot
cp tools/clang-wasix.cmake_toolchain /opt/wasix-sysroot/clang-wasix.cmake_toolchain
- name: Build and install compiler_rt builtins
run: |
mkdir -p build-compiler-rt-builtins
cd build-compiler-rt-builtins
cmake --fresh \
-DCOMPILER_RT_BAREMETAL_BUILD=On \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCOMPILER_RT_OS_DIR=wasm32-wasi \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=/opt/wasix-sysroot/clang-wasix.cmake_toolchain \
-DCMAKE_SYSROOT=/opt/wasix-sysroot \
-DCMAKE_INSTALL_PREFIX=/opt/wasix-sysroot \
../tools/llvm-project/compiler-rt/lib/builtins
cmake --build . --target install --parallel 4
llvm-ranlib /opt/wasix-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a
- name: Run WASIX tests
run: |
export CLANG_VERSION=$(clang --version | grep -i "clang version" | sed -n 's/.*version \([0-9.]*\).*/\1/p')
echo Detected clang version $CLANG_VERSION
mkdir -p /usr/lib/clang/19/lib/wasm32-wasmer-wasi
cp /opt/wasix-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a /usr/lib/clang/19/lib/wasm32-wasmer-wasi/libclang_rt.builtins.a
TOOLCHAIN=/opt/wasix-sysroot/clang-wasix.cmake_toolchain ./test/wasix/run_tests.sh
- name: Upload sysroot
uses: actions/upload-artifact@v4
with:
name: wasix-sysroot
path: /opt/wasix-sysroot