From 3ebdde33c47358490e7872b81f826b0ad38cd5ec Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 14 Dec 2025 18:06:33 +0900 Subject: [PATCH 1/4] Bump WASI SDK to version 25 It includes some new stubs (like fchmod) and they are necessary to build the latest ruby/ruby revisions. https://github.com/WebAssembly/wasi-libc/commit/cc62fa82c29bfced82d280cbccc231667ee80822 --- lib/ruby_wasm/build/toolchain.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ruby_wasm/build/toolchain.rb b/lib/ruby_wasm/build/toolchain.rb index 83b2a6459..8b0a27b40 100644 --- a/lib/ruby_wasm/build/toolchain.rb +++ b/lib/ruby_wasm/build/toolchain.rb @@ -56,7 +56,7 @@ class WASISDK < Toolchain def initialize( wasi_sdk_path = ENV["WASI_SDK_PATH"], build_dir: nil, - version_major: 21, + version_major: 25, version_minor: 0, binaryen_version: 108 ) @@ -111,8 +111,9 @@ def wasi_sdk_path def download_url(version_major, version_minor) version = "#{version_major}.#{version_minor}" assets = [ - [/x86_64-linux/, "wasi-sdk-#{version}-linux.tar.gz"], - [/(arm64e?|x86_64)-darwin/, "wasi-sdk-#{version}-macos.tar.gz"] + [/x86_64-linux/, "wasi-sdk-#{version}-x86_64-linux.tar.gz"], + [/arm64e?-darwin/, "wasi-sdk-#{version}-arm64-macos.tar.gz"], + [/x86_64-darwin/, "wasi-sdk-#{version}-x86_64-macos.tar.gz"] ] asset = assets.find { |os, _| os =~ RUBY_PLATFORM }&.at(1) if asset.nil? From a4bf1c1535f3830cabd0d7b2155793728d3a3c66 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 14 Dec 2025 22:25:57 +0900 Subject: [PATCH 2/4] Exclude aarch64-mingw-ucrt from build-gem matrix --- .github/workflows/build-gems.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-gems.yml b/.github/workflows/build-gems.yml index e743e2c7a..7556cced2 100644 --- a/.github/workflows/build-gems.yml +++ b/.github/workflows/build-gems.yml @@ -18,7 +18,7 @@ jobs: id: fetch with: supported-ruby-platforms: | - exclude: [arm-linux, x64-mingw32] + exclude: [arm-linux, x64-mingw32, aarch64-mingw-ucrt] stable-ruby-versions: | exclude: [head] From e3d5681125411e48120cda9e2aef1a2a3fdf9b2b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 20 Dec 2025 17:07:54 +0900 Subject: [PATCH 3/4] Revert "Bump WASI SDK to version 25" This reverts commit 3ebdde33c47358490e7872b81f826b0ad38cd5ec. --- lib/ruby_wasm/build/toolchain.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ruby_wasm/build/toolchain.rb b/lib/ruby_wasm/build/toolchain.rb index 8b0a27b40..83b2a6459 100644 --- a/lib/ruby_wasm/build/toolchain.rb +++ b/lib/ruby_wasm/build/toolchain.rb @@ -56,7 +56,7 @@ class WASISDK < Toolchain def initialize( wasi_sdk_path = ENV["WASI_SDK_PATH"], build_dir: nil, - version_major: 25, + version_major: 21, version_minor: 0, binaryen_version: 108 ) @@ -111,9 +111,8 @@ def wasi_sdk_path def download_url(version_major, version_minor) version = "#{version_major}.#{version_minor}" assets = [ - [/x86_64-linux/, "wasi-sdk-#{version}-x86_64-linux.tar.gz"], - [/arm64e?-darwin/, "wasi-sdk-#{version}-arm64-macos.tar.gz"], - [/x86_64-darwin/, "wasi-sdk-#{version}-x86_64-macos.tar.gz"] + [/x86_64-linux/, "wasi-sdk-#{version}-linux.tar.gz"], + [/(arm64e?|x86_64)-darwin/, "wasi-sdk-#{version}-macos.tar.gz"] ] asset = assets.find { |os, _| os =~ RUBY_PLATFORM }&.at(1) if asset.nil? From 2d5dcf26e7d51186ac9da412cf4f00b4249d5250 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 21 Dec 2025 00:16:37 +0900 Subject: [PATCH 4/4] Bump WASI SDK to version 22 --- lib/ruby_wasm/build/product/crossruby.rb | 11 +++++++++++ lib/ruby_wasm/build/toolchain.rb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/ruby_wasm/build/product/crossruby.rb b/lib/ruby_wasm/build/product/crossruby.rb index 736af0278..a4c5d2d43 100644 --- a/lib/ruby_wasm/build/product/crossruby.rb +++ b/lib/ruby_wasm/build/product/crossruby.rb @@ -345,6 +345,17 @@ def configure_args(build_triple, toolchain) wasi_sdk_path = @toolchain args << %Q(WASMOPT=#{wasi_sdk_path.wasm_opt}) args << %Q(WASI_SDK_PATH=#{wasi_sdk_path.wasi_sdk_path}) + # NOTE: wasi-libc 22 and later defines stubs for fchmod and chmod + # but they just return ENOTSUP, and ruby's configure doesn't check + # the runtime behavior. So we need to tell configure that + # these functions are not available. + # https://github.com/WebAssembly/wasi-libc/pull/463 + args << %Q(ac_cv_func_fchmod=no) + args << %Q(ac_cv_func_chmod=no) + # TODO: wasi-libc 22 and later started using musl's realpath impl but + # it broke Kernel#require on @bjorn3/browser_wasi_shim setup for some + # reason. So we disable it for now. + args << %Q(ac_cv_func_realpath=no) when "wasm32-unknown-emscripten" ldflags.concat(%w[-s MODULARIZE=1]) env_emcc_ldflags = ENV["RUBY_WASM_EMCC_LDFLAGS"] || "" diff --git a/lib/ruby_wasm/build/toolchain.rb b/lib/ruby_wasm/build/toolchain.rb index 83b2a6459..5c1043223 100644 --- a/lib/ruby_wasm/build/toolchain.rb +++ b/lib/ruby_wasm/build/toolchain.rb @@ -56,7 +56,7 @@ class WASISDK < Toolchain def initialize( wasi_sdk_path = ENV["WASI_SDK_PATH"], build_dir: nil, - version_major: 21, + version_major: 22, version_minor: 0, binaryen_version: 108 )