diff --git a/configure b/configure index 3af1c9d071..a696c35df3 100755 --- a/configure +++ b/configure @@ -118,7 +118,7 @@ class Configure # TODO: add conditionals for platforms if RbConfig::CONFIG["build_os"] =~ /darwin/ - @ldshared = "#{@cc} -dynamic -bundle -undefined suppress -flat_namespace" + @ldshared = "#{@cc} -bundle -undefined suppress -flat_namespace" else @ldshared = "#{@cc} -shared" end diff --git a/rakelib/ext_helper.rb b/rakelib/ext_helper.rb index 8452424b01..9acbe16cab 100644 --- a/rakelib/ext_helper.rb +++ b/rakelib/ext_helper.rb @@ -99,7 +99,14 @@ def add_mri_capi $LIBS << " #{DEFAULT["LIBS"]}" $LIBS << " #{DEFAULT["DLDLIBS"]}" - unless RUBY_PLATFORM =~ /mingw/ + case RUBY_PLATFORM + when /mingw/ + # do nothing + when /darwin/ + # necessary to avoid problems with RVM injecting flags into the MRI build + # process. + add_ldflag DEFAULT["LDSHARED"].split[1..-1].join(' ').gsub(/-dynamiclib/, "") + else add_ldflag DEFAULT["LDSHARED"].split[1..-1].join(' ') end @@ -183,7 +190,7 @@ def add_rbx_capi when /darwin/ # on Unix we need a g++ link, not gcc. # Ff line contributed by Daniel Harple. - $LDSHARED = "#{$CXX} -dynamic -bundle -undefined suppress -flat_namespace -lstdc++" + $LDSHARED = "#{$CXX} -bundle -undefined suppress -flat_namespace -lstdc++" when /aix/ $LDSHARED = "#{$CXX} -shared -Wl,-G -Wl,-brtl" diff --git a/spec/ruby/optional/capi/rake_helper.rb b/spec/ruby/optional/capi/rake_helper.rb index 35ca8aa5f5..b06bf17543 100644 --- a/spec/ruby/optional/capi/rake_helper.rb +++ b/spec/ruby/optional/capi/rake_helper.rb @@ -7,7 +7,7 @@ case PLATFORM when /darwin/ output = "#{$cwd}/#{$ext_name}.bundle" - build_cmd = "cc -dynamic -bundle -undefined suppress -flat_namespace #{common} -o #{output}" + build_cmd = "cc -bundle -undefined suppress -flat_namespace #{common} -o #{output}" else output = "#{$cwd}/#{$ext_name}.so" build_cmd = "cc -shared #{common} -o #{output}"