diff --git a/lib/ruby_wasm/build/product/crossruby.rb b/lib/ruby_wasm/build/product/crossruby.rb index e6dd12d3a6..361ba4f714 100644 --- a/lib/ruby_wasm/build/product/crossruby.rb +++ b/lib/ruby_wasm/build/product/crossruby.rb @@ -34,6 +34,7 @@ def feature_name(crossruby) def make_args(crossruby) make_args = [] make_args << "CC=#{@toolchain.cc}" + make_args << "CXX=#{@toolchain.cc}" make_args << "LD=#{@toolchain.ld}" make_args << "AR=#{@toolchain.ar}" make_args << "RANLIB=#{@toolchain.ranlib}" diff --git a/lib/ruby_wasm/build/product/product.rb b/lib/ruby_wasm/build/product/product.rb index 8e0c78ce36..8a443da397 100644 --- a/lib/ruby_wasm/build/product/product.rb +++ b/lib/ruby_wasm/build/product/product.rb @@ -26,6 +26,7 @@ def system_triplet_args def tools_args args = [] args << "CC=#{@toolchain.cc}" + args << "CXX=#{@toolchain.cxx}" args << "LD=#{@toolchain.ld}" args << "AR=#{@toolchain.ar}" args << "RANLIB=#{@toolchain.ranlib}" diff --git a/lib/ruby_wasm/build/toolchain.rb b/lib/ruby_wasm/build/toolchain.rb index 0347371c7d..c80cbb98a0 100644 --- a/lib/ruby_wasm/build/toolchain.rb +++ b/lib/ruby_wasm/build/toolchain.rb @@ -43,7 +43,7 @@ def self.check_executable(command) tool end - %i[cc ranlib ld ar].each do |name| + %i[cc cxx ranlib ld ar].each do |name| define_method(name) do @tools_cache ||= {} @tools_cache[name] ||= find_tool(name) @@ -84,6 +84,7 @@ def initialize( @tools = { cc: "#{wasi_sdk_path}/bin/clang", + cxx: "#{wasi_sdk_path}/bin/clang++", ld: "#{wasi_sdk_path}/bin/clang", ar: "#{wasi_sdk_path}/bin/llvm-ar", ranlib: "#{wasi_sdk_path}/bin/llvm-ranlib" diff --git a/sig/ruby_wasm/build.rbs b/sig/ruby_wasm/build.rbs index 5f1b714d6b..bf7c0cd065 100644 --- a/sig/ruby_wasm/build.rbs +++ b/sig/ruby_wasm/build.rbs @@ -242,6 +242,7 @@ module RubyWasm def self.find_path: (String command) -> String? def self.check_executable: (String command) -> String def cc: -> String + def cxx: -> String def ranlib: -> String def ld: -> String def ar: -> String