From fbeb96dee407f7f03306823c313c55cc88c33368 Mon Sep 17 00:00:00 2001 From: csh <458761603@qq.com> Date: Sat, 13 Jul 2024 16:40:58 +0800 Subject: [PATCH] Update README.md for Build on Mac Signed-off-by: csh <458761603@qq.com> --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index f008703..4861e8f 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,29 @@ We need to add some code into `src/main.rs`. ## Build and run it +
+ + Note on Mac + +> `ring v0.17` can't build on Mac with default clang. +> So, you need install wasi-sdk. + +### [Download wasi-sdk](https://github.com/WebAssembly/wasi-sdk?tab=readme-ov-file#install) +``` +export WASI_VERSION=22 +export WASI_VERSION_FULL=${WASI_VERSION}.0 +wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz +tar xvf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz +``` + +### [Use the clang included in wasi-sdk for compilation.](https://github.com/WebAssembly/wasi-sdk?tab=readme-ov-file#use) +``` +export WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_VERSION_FULL} +export CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot" +``` + +
+ First we need to compile the code. You will need to pass some flags to make sure that the Rust compiler knows to use the correct patches for the `wasmedge` target. ```bash