Skip to content

Commit 03c72b4

Browse files
Specify CXX when building crossruby
Some extconf.rb scripts use CXX to compile C++ code even though CRuby itself doesn't require C++ compiler. This change allows such scripts to work correctly.
1 parent 94ce022 commit 03c72b4

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

lib/ruby_wasm/build/product/crossruby.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def feature_name(crossruby)
3434
def make_args(crossruby)
3535
make_args = []
3636
make_args << "CC=#{@toolchain.cc}"
37+
make_args << "CXX=#{@toolchain.cc}"
3738
make_args << "LD=#{@toolchain.ld}"
3839
make_args << "AR=#{@toolchain.ar}"
3940
make_args << "RANLIB=#{@toolchain.ranlib}"

lib/ruby_wasm/build/product/product.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def system_triplet_args
2626
def tools_args
2727
args = []
2828
args << "CC=#{@toolchain.cc}"
29+
args << "CXX=#{@toolchain.cxx}"
2930
args << "LD=#{@toolchain.ld}"
3031
args << "AR=#{@toolchain.ar}"
3132
args << "RANLIB=#{@toolchain.ranlib}"

lib/ruby_wasm/build/toolchain.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def self.check_executable(command)
4343
tool
4444
end
4545

46-
%i[cc ranlib ld ar].each do |name|
46+
%i[cc cxx ranlib ld ar].each do |name|
4747
define_method(name) do
4848
@tools_cache ||= {}
4949
@tools_cache[name] ||= find_tool(name)
@@ -84,6 +84,7 @@ def initialize(
8484

8585
@tools = {
8686
cc: "#{wasi_sdk_path}/bin/clang",
87+
cxx: "#{wasi_sdk_path}/bin/clang++",
8788
ld: "#{wasi_sdk_path}/bin/clang",
8889
ar: "#{wasi_sdk_path}/bin/llvm-ar",
8990
ranlib: "#{wasi_sdk_path}/bin/llvm-ranlib"

sig/ruby_wasm/build.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ module RubyWasm
242242
def self.find_path: (String command) -> String?
243243
def self.check_executable: (String command) -> String
244244
def cc: -> String
245+
def cxx: -> String
245246
def ranlib: -> String
246247
def ld: -> String
247248
def ar: -> String

0 commit comments

Comments
 (0)