diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets
index 7f981dde513c7..c89a257a88a0d 100644
--- a/eng/testing/tests.wasi.targets
+++ b/eng/testing/tests.wasi.targets
@@ -13,7 +13,7 @@
>true
- $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasi', 'wasi-sdk'))
+ $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasi', 'wasi-sdk'))
$([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)').Replace('\', '/'))
<_BundleAOTTestWasmAppForHelixDependsOn>$(_BundleAOTTestWasmAppForHelixDependsOn);PrepareForWasiBuildApp;_PrepareForAOTOnHelix
diff --git a/src/libraries/sendtohelix-wasi.targets b/src/libraries/sendtohelix-wasi.targets
index 1e9c736e01aa1..0a22d5f70136e 100644
--- a/src/libraries/sendtohelix-wasi.targets
+++ b/src/libraries/sendtohelix-wasi.targets
@@ -46,7 +46,7 @@
false
false
- $([MSBuild]::NormalizeDirectory($(RepoRoot), 'src', 'mono', 'wasi', 'wasi-sdk'))
+ $([MSBuild]::NormalizeDirectory($(RepoRoot), 'src', 'mono', 'wasi', 'wasi-sdk'))
$([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)').Replace('\', '/'))
$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasi', 'build'))
$(HelixDependenciesStagingPath)$(WorkItemPrefix)wasi-sdk
diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt
index e18c1b026ef0d..f0160b4974df5 100644
--- a/src/mono/CMakeLists.txt
+++ b/src/mono/CMakeLists.txt
@@ -245,7 +245,7 @@ elseif(CLR_CMAKE_HOST_OS STREQUAL "emscripten")
set(HAVE_SYS_RANDOM_H 1)
elseif(CLR_CMAKE_HOST_OS STREQUAL "wasi")
set(HOST_WASI 1)
- add_definitions(-D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -DHOST_WASI)
+ add_definitions(-D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_PTHREAD -DHOST_WASI)
add_definitions(-D_THREAD_SAFE)
add_definitions(-DDISABLE_EGD_SOCKET)
add_definitions(-DDISABLE_EVENTPIPE)
diff --git a/src/mono/Directory.Build.props b/src/mono/Directory.Build.props
index 24e83e50107de..6b6a4f6aa77bf 100644
--- a/src/mono/Directory.Build.props
+++ b/src/mono/Directory.Build.props
@@ -34,9 +34,9 @@
- $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), 'wasi', 'wasi-sdk'))
+ $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), 'wasi', 'wasi-sdk'))
$([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)').Replace('\', '/'))
- true
+ true
diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake
index de690240bfad4..b5cf1c625e4bb 100644
--- a/src/mono/cmake/configure.cmake
+++ b/src/mono/cmake/configure.cmake
@@ -27,7 +27,7 @@ if(HOST_HAIKU)
endif()
if(HOST_WASI)
- set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN")
+ set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_PTHREAD")
endif()
function(ac_check_headers)
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index cc4d240fe835f..947ced98b7402 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -326,13 +326,14 @@ JS_ENGINES = [NODE_JS]
$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasi'))
%(_VersionLines.Identity)
- https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-x86_64-linux.tar.gz
- https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-x86_64-macos.tar.gz
- https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-x86_64-windows.tar.gz
+ $(WasiSdkVersion.Split('.')[0])
+ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkMajorVersion)/wasi-sdk-$(WasiSdkVersion)-x86_64-linux.tar.gz
+ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkMajorVersion)/wasi-sdk-$(WasiSdkVersion)-x86_64-macos.tar.gz
+ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkMajorVersion)/wasi-sdk-$(WasiSdkVersion)-x86_64-windows.tar.gz
-
@@ -341,8 +342,7 @@ JS_ENGINES = [NODE_JS]
Condition="'$(HostOS)' == 'windows'"
WorkingDirectory="$(ArtifactsObjDir)"
IgnoreStandardErrorWarningFormat="true" />
-
-
+
@@ -359,20 +359,6 @@ JS_ENGINES = [NODE_JS]
-
-
-
-
-
-
@@ -601,6 +587,7 @@ JS_ENGINES = [NODE_JS]
<_MonoCFLAGS Include="-D_WASI_EMULATED_PROCESS_CLOCKS"/>
<_MonoCFLAGS Include="-D_WASI_EMULATED_SIGNAL"/>
<_MonoCFLAGS Include="-D_WASI_EMULATED_MMAN"/>
+ <_MonoCFLAGS Include="-D_WASI_EMULATED_PTHREAD"/>
diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets
index f781e6469de22..ca48af019c13c 100644
--- a/src/mono/wasi/build/WasiApp.targets
+++ b/src/mono/wasi/build/WasiApp.targets
@@ -100,8 +100,14 @@
<_ToolchainMissingPaths Condition="'$(_ToolchainMissingPaths)' == '' and ('$(WasiClang)' == '' or !Exists('$(WasiClang)'))">%24(WasiClang)=$(WasiClang)
+
+
+
- <_ToolchainMissingErrorMessage Condition="'$(WASI_SDK_PATH)' == '' or !Exists('$(WASI_SDK_PATH)/VERSION24')">Could not find wasi-sdk. Install wasi-sdk and set %24(WASI_SDK_PATH) . It can be obtained from https://github.com/WebAssembly/wasi-sdk/releases
+ <_ExpectedWasiSdkVersion>25.0
+ <_FoundExpectedWasiSdkVersion Condition="'%(_WasiSdkVersionLines.Identity)' == '$(_ExpectedWasiSdkVersion)'">true
+ <_ToolchainMissingErrorMessage Condition="'$(_FoundExpectedWasiSdkVersion)' == ''">Please use wasi-sdk version $(_ExpectedWasiSdkVersion) and set %24(WASI_SDK_PATH) . It can be obtained from https://github.com/WebAssembly/wasi-sdk/releases
+ <_ToolchainMissingErrorMessage Condition="'$(WASI_SDK_PATH)' == '' or !Exists('$(WASI_SDK_PATH)/VERSION')">Could not find wasi-sdk. Install wasi-sdk and set %24(WASI_SDK_PATH) . It can be obtained from https://github.com/WebAssembly/wasi-sdk/releases
<_ToolchainMissingErrorMessage Condition="'$(_ToolchainMissingErrorMessage)' == '' and '$(_ToolchainMissingPaths)' != ''">Using WASI_SDK_PATH=$(WASI_SDK_PATH), cannot find $(_ToolchainMissingPaths) .
<_IsToolchainMissing Condition="'$(_ToolchainMissingErrorMessage)' != ''">true
@@ -356,7 +362,7 @@
<_WasiLinkStepArgs Include="-Wl,--export=malloc,--export=free,--export=__heap_base,--export=__data_end" />
- <_WasiLinkStepArgs Include="-Wl,-z,stack-size=8388608,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman"/>
+ <_WasiLinkStepArgs Include="-Wl,-z,stack-size=8388608,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman,-lwasi-emulated-pthread"/>
- <_WasiLinkFlags Include="-Wl,-z,stack-size=8388608,--initial-memory=52428800,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman"/>
+ <_WasiLinkFlags Include="-Wl,-z,stack-size=8388608,--initial-memory=52428800,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman,-lwasi-emulated-pthread"/>
diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.props b/src/mono/wasm/build/WasmApp.LocalBuild.props
index 0c9d024c25ad9..dc9b562089a3a 100644
--- a/src/mono/wasm/build/WasmApp.LocalBuild.props
+++ b/src/mono/wasm/build/WasmApp.LocalBuild.props
@@ -30,7 +30,7 @@
$(RuntimeSrcDir)\artifacts\bin\
$(RuntimeSrcDir)\src\mono\browser\emsdk\
- $([MSBuild]::NormalizeDirectory($(RuntimeSrcDir), 'src', 'mono', 'wasi', 'wasi-sdk'))
+ $([MSBuild]::NormalizeDirectory($(RuntimeSrcDir), 'src', 'mono', 'wasi', 'wasi-sdk'))
$([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)').Replace('\', '/'))
$([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.$(RuntimeIdentifier)', $(RuntimeConfig)))
diff --git a/src/mono/wasm/data/aot-tests/Directory.Build.props b/src/mono/wasm/data/aot-tests/Directory.Build.props
index fa8a2fb8f3d68..3728136a63d1e 100644
--- a/src/mono/wasm/data/aot-tests/Directory.Build.props
+++ b/src/mono/wasm/data/aot-tests/Directory.Build.props
@@ -10,7 +10,7 @@
<_WasmTargetsDir>$(WasmBuildSupportDir)\wasm\
<_WasmSharedDir>$(WasmBuildSupportDir)\wasm-shared\
$(WasmBuildSupportDir)\emsdk\
- $(WasmBuildSupportDir)/wasi-sdk/
+ $(WasmBuildSupportDir)/wasi-sdk/
diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt
index 03c5036fd8b91..7a7d94ee80842 100644
--- a/src/native/libs/CMakeLists.txt
+++ b/src/native/libs/CMakeLists.txt
@@ -58,9 +58,10 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
add_compile_options(-D_WASI_EMULATED_PROCESS_CLOCKS)
add_compile_options(-D_WASI_EMULATED_SIGNAL)
add_compile_options(-D_WASI_EMULATED_MMAN)
+ add_compile_options(-D_WASI_EMULATED_PTHREAD)
# keep in sync with src\mono\wasi\build\WasiApp.targets
# keep in sync with src\mono\wasi\wasi.proj
- add_link_options(-Wl,-z,stack-size=1048576,--initial-memory=5242880,--max-memory=52428800,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman)
+ add_link_options(-Wl,-z,stack-size=1048576,--initial-memory=5242880,--max-memory=52428800,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman,-lwasi-emulated-pthread)
endif ()
if (CLR_CMAKE_TARGET_ANDROID)
diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj
index 5102566d5cb6e..29b0e7f7efca5 100644
--- a/src/native/libs/build-native.proj
+++ b/src/native/libs/build-native.proj
@@ -27,7 +27,7 @@
- $([MSBuild]::NormalizeDirectory($(RepoRoot), 'src', 'mono', 'wasi', 'wasi-sdk'))
+ $([MSBuild]::NormalizeDirectory($(RepoRoot), 'src', 'mono', 'wasi', 'wasi-sdk'))
$([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)').Replace('\', '/'))
<_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);WASI_SDK_PATH=$(WASI_SDK_PATH)