Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187)

Raise wasi-sdk to 25 and wabt to 1.0.37. It includes
  - Refactor CI workflow to install WASI-SDK and WABT from a composite action
  - Use ExternalProject to bring wasm-apps for few samples. file/ wasi-threads/
  - Refactor sample build and test steps in SGX compilation workflow for improved clarity and efficiency (workaround)

Add CMake support for EMSCRIPTEN and WAMRC, update module paths
This commit is contained in:
liang.he 2025-04-17 16:41:47 +08:00 committed by GitHub
parent ecb47d9326
commit 8f8c5605e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 213 additions and 266 deletions

View File

@ -0,0 +1,80 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Get URLs from:
# - https://github.com/WebAssembly/wasi-sdk/releases
# - https://github.com/WebAssembly/wabt/releases
# Install WASI-SDK and WABT at /opt
# /opt is the assumed location widely used in the project
name: Install WASI-SDK and WABT
description: A composite action to download and install wasi-sdk and wabt on Ubuntu, macOS.
inputs:
os:
description: "Operating system to install on (ubuntu, macos)"
required: true
runs:
using: "composite"
steps:
- name: Check Runner OS
if: ${{ !startsWith(inputs.os, 'ubuntu') && !startsWith(inputs.os, 'windows') && !startsWith(inputs.os, 'macos') }}
shell: bash
run: |
echo "::error title=⛔ error hint::Support Ubuntu, Windows, and macOS Only"
exit 1
- name: Set up wasi-sdk and wabt on Ubuntu
if: ${{ startsWith(inputs.os, 'ubuntu') }}
shell: bash
run: |
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
sudo tar -xf wasi-sdk.tar.gz
sudo ln -sf wasi-sdk-25.0-x86_64-linux/ wasi-sdk
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-ubuntu-20.04.tar.gz
sudo tar -xf wabt.tar.gz
sudo ln -sf wabt-1.0.37 wabt
/opt/wasi-sdk/bin/clang --version
/opt/wabt/bin/wasm-interp --version
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ubuntu"
working-directory: /opt
- name: Set up wasi-sdk and wabt on macOS-13 (intel)
if: ${{ inputs.os == 'macos-13' }}
shell: bash
run: |
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-macos.tar.gz
sudo tar -xf wasi-sdk.tar.gz
sudo ln -sf wasi-sdk-25.0-x86_64-macos wasi-sdk
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.36/wabt-1.0.36-macos-12.tar.gz
sudo tar -xf wabt.tar.gz
sudo ln -sf wabt-1.0.36 wabt
/opt/wasi-sdk/bin/clang --version
/opt/wabt/bin/wasm-interp --version
echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on macos-13"
working-directory: /opt
- name: Set up wasi-sdk and wabt on macOS-14 (arm64)
if: ${{ inputs.os == 'macos-14' }}
shell: bash
run: |
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-arm64-macos.tar.gz
sudo tar -xf wasi-sdk.tar.gz
sudo ln -sf wasi-sdk-25.0-arm64-macos wasi-sdk
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-macos-14.tar.gz
sudo tar -xf wabt.tar.gz
sudo ln -sf wabt-1.0.37 wabt
/opt/wasi-sdk/bin/clang --version
/opt/wabt/bin/wasm-interp --version
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on macos-14"
working-directory: /opt
#TODO: Add support for Windows
- name: Set up wasi-sdk and wabt on Windows
if: ${{ startsWith(inputs.os, 'windows') }}
shell: powershell
run: |
echo "::notice::Support for Windows is not implemented yet"
exit 1

View File

@ -315,17 +315,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-22.04] os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz"
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -346,19 +339,10 @@ jobs:
if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wasi-sdk - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wasi_sdk_release }} os: ${{ matrix.os }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo ln -sf wasi-sdk-25.0-x86_64-linux wasi-sdk
- name: download and install wabt
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt
- name: Build wamrc - name: Build wamrc
run: | run: |
@ -397,14 +381,6 @@ jobs:
$MULTI_TIER_JIT_BUILD_OPTIONS, $MULTI_TIER_JIT_BUILD_OPTIONS,
] ]
os: [ubuntu-22.04] os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
@ -430,12 +406,10 @@ jobs:
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wabt - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wabt_release }} os: ${{ matrix.os }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt
- name: Build wamrc - name: Build wamrc
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
@ -464,34 +438,14 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04] os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz"
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: download and install wasi-sdk
run: |
cd /opt
sudo wget ${{ matrix.wasi_sdk_release }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo ln -sf wasi-sdk-25.0-x86_64-linux wasi-sdk
- name: download and install wabt
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo ln -sf wabt-1.0.31 wabt
- name: Get LLVM libraries - name: Get LLVM libraries
id: retrieve_llvm_libs id: retrieve_llvm_libs
uses: actions/cache@v4 uses: actions/cache@v4
@ -503,12 +457,19 @@ jobs:
./core/deps/llvm/build/libexec ./core/deps/llvm/build/libexec
./core/deps/llvm/build/share ./core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }} key: ${{ matrix.llvm_cache_key }}
- name: install-wasi-sdk-wabt
uses: ./.github/actions/install-wasi-sdk-wabt
with:
os: ${{ matrix.os }}
- name: Build wamrc - name: Build wamrc
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
cmake --build . --config Release --parallel 4 cmake --build . --config Release --parallel 4
working-directory: wamr-compiler working-directory: wamr-compiler
- name: Build Sample [basic] - name: Build Sample [basic]
run: | run: |
cd samples/basic cd samples/basic
@ -634,10 +595,6 @@ jobs:
$MEMORY64_TEST_OPTIONS, $MEMORY64_TEST_OPTIONS,
$MULTI_MEMORY_TEST_OPTIONS, $MULTI_MEMORY_TEST_OPTIONS,
] ]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz"
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
@ -706,11 +663,9 @@ jobs:
- name: download and install wasi-sdk - name: download and install wasi-sdk
if: matrix.test_option == '$WASI_TEST_OPTIONS' if: matrix.test_option == '$WASI_TEST_OPTIONS'
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wasi_sdk_release }} os: ${{ matrix.os }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo ln -sf wasi-sdk-25.0-x86_64-linux wasi-sdk
# It is a temporary solution until new wasi-sdk that includes bug fixes is released # It is a temporary solution until new wasi-sdk that includes bug fixes is released
- name: build wasi-libc from source - name: build wasi-libc from source

View File

@ -228,24 +228,14 @@ jobs:
#$AOT_BUILD_OPTIONS, #$AOT_BUILD_OPTIONS,
] ]
os: [macos-13] os: [macos-13]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz",
]
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: download and install wabt - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wabt_release }} os: ${{ matrix.os }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt
- name: Build Sample [wasm-c-api] - name: Build Sample [wasm-c-api]
run: | run: |
@ -260,14 +250,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [macos-13, macos-14] os: [macos-13, macos-14]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-macos-12.tar.gz",
]
include: include:
- os: macos-13 - os: macos-13
llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
@ -277,19 +259,10 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: download and install wasi-sdk - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wasi_sdk_release }} os: ${{ matrix.os }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo ln -sf wasi-sdk-20.0 wasi-sdk
- name: download and install wabt
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo ln -sf wabt-1.0.31 wabt
- name: Build Sample [basic] - name: Build Sample [basic]
run: | run: |
@ -356,12 +329,13 @@ jobs:
cmake --build . --config Release --parallel 4 cmake --build . --config Release --parallel 4
working-directory: wamr-compiler working-directory: wamr-compiler
# cmake --build . --config Debug --parallel 4
- name: Build Sample [wasi-threads] - name: Build Sample [wasi-threads]
run: | run: |
cd samples/wasi-threads cd samples/wasi-threads
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
cmake --build . --config Debug --parallel 4 cmake --build . --config Debug --verbose
./iwasm wasm-apps/no_pthread.wasm ./iwasm wasm-apps/no_pthread.wasm
../../../wamr-compiler/build/wamrc --size-level=0 --enable-multi-thread -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm ../../../wamr-compiler/build/wamrc --size-level=0 --enable-multi-thread -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm

View File

@ -147,14 +147,6 @@ jobs:
#$LLVM_EAGER_JIT_BUILD_OPTIONS, #$LLVM_EAGER_JIT_BUILD_OPTIONS,
] ]
os: [ubuntu-22.04] os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
iwasm_make_options_feature: [ iwasm_make_options_feature: [
# Features to be tested: IPFS # Features to be tested: IPFS
"-DWAMR_BUILD_SGX_IPFS=1", "-DWAMR_BUILD_SGX_IPFS=1",
@ -168,19 +160,10 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: download and install wasi-sdk - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wasi_sdk_release }} os: ${{ matrix.os }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo mv wasi-sdk-19.0 wasi-sdk
- name: download and install wabt
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt
- name: install SGX SDK and necessary libraries - name: install SGX SDK and necessary libraries
uses: ./.github/actions/install-linux-sgx uses: ./.github/actions/install-linux-sgx
@ -213,33 +196,31 @@ jobs:
- name: Build wamrc only for testing samples in aot mode - name: Build wamrc only for testing samples in aot mode
if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS' if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
run: | run: |
mkdir build && cd build cmake -S . -B build
cmake .. cmake --build build --config Release --parallel 4
cmake --build . --config Release --parallel 4 cp build/wamrc ../product-mini/platforms/${{ matrix.platform }}/enclave-sample
cp wamrc `pwd`/../../product-mini/platforms/${{ matrix.platform }}/enclave-sample
working-directory: wamr-compiler working-directory: wamr-compiler
- name: Build Sample [file] - name: Build Sample [file]
run: | run: |
cd samples/file cmake -S . -B build
mkdir build && cd build cmake --build build --config Debug --parallel 4
cmake .. cp build/wasm-app/file.wasm ../../product-mini/platforms/${{ matrix.platform }}/enclave-sample
cmake --build . --config Debug --parallel 4 working-directory: samples/file
cp wasm-app/file.wasm `pwd`/../../../product-mini/platforms/${{ matrix.platform }}/enclave-sample
- name: Test Sample [file] in non-aot mode - name: Test Sample [file] in non-aot mode
if: matrix.iwasm_make_options_run_mode != '$AOT_BUILD_OPTIONS' if: matrix.iwasm_make_options_run_mode != '$AOT_BUILD_OPTIONS'
run: | run: |
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
./iwasm --dir=. file.wasm ./iwasm --dir=. ./file.wasm
working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample
- name: Test Sample [file] in aot mode - name: Test Sample [file] in aot mode
if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS' if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
run: | run: |
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
./wamrc -sgx -o file.aot file.wasm ./wamrc -sgx -o ./file.aot ./file.wasm
./iwasm --dir=. file.aot ./iwasm --dir=. ./file.aot
working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample
spec_test_default: spec_test_default:

View File

@ -378,14 +378,6 @@ jobs:
$MULTI_TIER_JIT_BUILD_OPTIONS, $MULTI_TIER_JIT_BUILD_OPTIONS,
] ]
os: [ubuntu-22.04] os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
@ -413,12 +405,11 @@ jobs:
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wabt - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wabt_release }} os: ${{ matrix.os }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt
- name: Build wamrc - name: Build wamrc
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
run: | run: |
@ -443,14 +434,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04] os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
@ -458,18 +441,10 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: download and install wasi-sdk - name: install-wasi-sdk-wabt
run: | uses: ./.github/actions/install-wasi-sdk-wabt
cd /opt with:
sudo wget ${{ matrix.wasi_sdk_release }} os: ${{ matrix.os }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo ln -sf wasi-sdk-20.0 wasi-sdk
- name: download and install wabt
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo ln -sf wabt-1.0.31 wabt
- name: Get LLVM libraries - name: Get LLVM libraries
id: retrieve_llvm_libs id: retrieve_llvm_libs
@ -567,17 +542,21 @@ jobs:
./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so --native-lib=./libtest_hello2.so wasm-app/test.wasm ./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so --native-lib=./libtest_hello2.so wasm-app/test.wasm
working-directory: ./samples/native-lib working-directory: ./samples/native-lib
- name: checkout wamr-app-framework # FIXME: un-comment me after fix cmake minimum issue
run: git clone https://github.com/bytecodealliance/wamr-app-framework.git # https://github.com/bytecodealliance/wamr-app-framework/pull/11
- name: download wamr-app-framework dependencies # - name: checkout wamr-app-framework
run: LVGL=0 LV_DRIVERS=0 ./download.sh # run: git clone https://github.com/bytecodealliance/wamr-app-framework.git
working-directory: ./wamr-app-framework/deps
- name: Build Sample [simple] # - name: download wamr-app-framework dependencies
run: | # run: LVGL=0 LV_DRIVERS=0 ./download.sh
./build.sh -p host-interp # working-directory: ./wamr-app-framework/deps
python3 ./sample_test_run.py $(pwd)/out
exit $? # - name: Build Sample [simple]
working-directory: ./wamr-app-framework/samples/simple # run: |
# ./build.sh -p host-interp
# python3 ./sample_test_run.py $(pwd)/out
# exit $?
# working-directory: ./wamr-app-framework/samples/simple
- name: Build Sample [shared-heap] - name: Build Sample [shared-heap]
run: | run: |
@ -613,10 +592,6 @@ jobs:
$THREADS_TEST_OPTIONS, $THREADS_TEST_OPTIONS,
$WASI_TEST_OPTIONS, $WASI_TEST_OPTIONS,
] ]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
@ -664,13 +639,10 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: download and install wasi-sdk - name: install-wasi-sdk-wabt
if: matrix.test_option == '$WASI_TEST_OPTIONS' uses: ./.github/actions/install-wasi-sdk-wabt
run: | with:
cd /opt os: ${{ matrix.os }}
sudo wget ${{ matrix.wasi_sdk_release }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo mv wasi-sdk-20.0 wasi-sdk
# It is a temporary solution until new wasi-sdk that includes bug fixes is released # It is a temporary solution until new wasi-sdk that includes bug fixes is released
- name: build wasi-libc from source - name: build wasi-libc from source

View File

@ -98,6 +98,11 @@ if (NOT DEFINED WAMR_BUILD_STATIC_PGO)
set (WAMR_BUILD_STATIC_PGO 0) set (WAMR_BUILD_STATIC_PGO 0)
endif () endif ()
if (NOT DEFINED WAMR_BUILD_REF_TYPES)
# Enable reference types by default
set (WAMR_BUILD_REF_TYPES 1)
endif ()
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -ffunction-sections -fdata-sections \ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -ffunction-sections -fdata-sections \
-Wall -Wno-unused-parameter -Wno-pedantic \ -Wall -Wno-unused-parameter -Wno-pedantic \

View File

@ -19,6 +19,7 @@ if(WASISDK_FOUND)
set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang) set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang)
set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++) set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++)
set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake) set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake)
set(WASISDK_PTHREAD_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk-pthread.cmake)
set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot) set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot)
endif() endif()
mark_as_advanced(WASISDK_CC_COMMAND WASISDK_CXX_COMMAND WASISDK_TOOLCHAIN WASISDK_SYSROOT WASISDK_HOME) mark_as_advanced(WASISDK_CC_COMMAND WASISDK_CXX_COMMAND WASISDK_TOOLCHAIN WASISDK_PTHREAD_TOOLCHAIN WASISDK_SYSROOT WASISDK_HOME)

View File

@ -7,7 +7,7 @@ include(CheckPIESupported)
project(debug_tools_sample) project(debug_tools_sample)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
find_package(WASISDK REQUIRED) find_package(WASISDK REQUIRED)
option(SOURCE_MAP_DEMO "Enable source map demo" OFF) option(SOURCE_MAP_DEMO "Enable source map demo" OFF)

View File

@ -7,7 +7,7 @@ project (debut_tools_wasm)
set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line) set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake)
find_package (WAMRC REQUIRED) find_package (WAMRC REQUIRED)
option(SOURCE_MAP_DEMO "Enable source map demo" OFF) option(SOURCE_MAP_DEMO "Enable source map demo" OFF)

View File

@ -6,4 +6,20 @@ project(file)
################ wasm application ############### ################ wasm application ###############
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(wasm-app)
# Use ExternalProject to avoid incorporating WAMR library compilation flags into the
# compilation of the wasm application, which could lead to compatibility
# issues due to different targets.
# Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi'
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
find_package(WASISDK REQUIRED)
include(ExternalProject)
ExternalProject_Add(wasm-app
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-app"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-app -B build
-DWASI_SDK_PREFIX=${WASISDK_HOME}
-DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
BUILD_COMMAND ${CMAKE_COMMAND} --build build
INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -2,25 +2,10 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(wasm-app) project(file_wasm)
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line)
if (APPLE) add_executable(file main.c)
set (HAVE_FLAG_SEARCH_PATHS_FIRST 0) set_target_properties (file PROPERTIES SUFFIX .wasm)
set (CMAKE_C_LINK_FLAGS "") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/file.wasm DESTINATION wasm-app)
set (CMAKE_CXX_LINK_FLAGS "")
endif ()
set (CMAKE_SYSTEM_PROCESSOR wasm32)
if (NOT DEFINED WASI_SDK_DIR)
set (WASI_SDK_DIR "/opt/wasi-sdk")
endif ()
set (CMAKE_C_COMPILER_TARGET "wasm32-wasi")
set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument")
add_executable(file.wasm main.c)
target_link_libraries(file.wasm)

View File

@ -15,7 +15,7 @@ endif()
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
find_package(WASISDK REQUIRED) find_package(WASISDK REQUIRED)
################ runtime settings ################ ################ runtime settings ################

View File

@ -1,23 +0,0 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
include(FindPackageHandleStandardArgs)
file(GLOB WASISDK_SEARCH_PATH "/opt/wasi-sdk-*")
find_path(WASISDK_HOME
NAMES share/wasi-sysroot
PATHS ${WASISDK_SEARCH_PATH}
NO_DEFAULT_PATH
REQUIRED
)
string(REGEX MATCH [0-9]+\.[0-9]+\.*[0-9]* WASISDK_VERSION ${WASISDK_HOME})
find_package_handle_standard_args(WASISDK REQUIRED_VARS WASISDK_HOME VERSION_VAR WASISDK_VERSION)
if(WASISDK_FOUND)
set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang)
set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++)
set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake)
set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot)
endif()

View File

@ -66,7 +66,24 @@ add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
################ wasm application ################ ################ wasm application ################
add_subdirectory(wasm-apps) # Use ExternalProject to avoid incorporating WAMR library compilation flags into the
# compilation of the wasm application, which could lead to compatibility
# issues due to different targets.
# Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi'
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
find_package(WASISDK REQUIRED)
include(ExternalProject)
ExternalProject_Add(wasm-apps
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps -B build
-DWASI_SDK_PREFIX=${WASISDK_HOME}
-DCMAKE_TOOLCHAIN_FILE=${WASISDK_PTHREAD_TOOLCHAIN}
BUILD_COMMAND ${CMAKE_COMMAND} --build build
INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
)
################ wamr runtime ################ ################ wamr runtime ################
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

View File

@ -1,28 +1,10 @@
# Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
if (APPLE) cmake_minimum_required (VERSION 3.14)
set (HAVE_FLAG_SEARCH_PATHS_FIRST 0) project (wasi_threads_wasm)
set (CMAKE_C_LINK_FLAGS "")
set (CMAKE_CXX_LINK_FLAGS "")
endif ()
if (NOT DEFINED WASI_SDK_DIR) set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line)
set (WASI_SDK_DIR "/opt/wasi-sdk")
endif ()
if (DEFINED WASI_SYSROOT)
set (CMAKE_SYSROOT "${WASI_SYSROOT}")
endif ()
set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
set (CMAKE_ASM_COMPILER "${WASI_SDK_DIR}/bin/clang")
set (CMAKE_EXE_LINKER_FLAGS "-target wasm32-wasi-threads")
if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1)
set (CMAKE_C_FLAGS "")
set (CMAKE_CXX_FLAGS "")
endif ()
function (compile_sample SOURCE_FILE) function (compile_sample SOURCE_FILE)
get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE) get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE)
@ -41,6 +23,8 @@ function (compile_sample SOURCE_FILE)
LINKER:--export=malloc LINKER:--export=malloc
LINKER:--export=free LINKER:--export=free
) )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WASM_MODULE} DESTINATION wasm-apps)
endfunction () endfunction ()
compile_sample(no_pthread.c wasi_thread_start.S) compile_sample(no_pthread.c wasi_thread_start.S)