Skip to content

Commit ce619f2

Browse files
authored
Merge pull request #94 from rake-compiler/flavorjones-ruby-3.2-darwin-dldflags
darwin: work around the Ruby 3.2 symbol resolution changes
2 parents db23ffd + 0328204 commit ce619f2

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

Dockerfile.mri.erb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed
190190
RUN find /usr/local/rake-compiler/ruby -name lib*-ruby*.dll.a | while read f ; do n=`echo $f | sed s/.dll//` ; mv $f $n ; done
191191
<% end %>
192192

193+
# ruby-2.5 links to libcrypt, which isn't necessary for extensions
194+
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
195+
196+
<% if platform=~/darwin/ %>
197+
# ruby-3.2 on darwin links with `-bundle_loader`, see https://github.com/rake-compiler/rake-compiler-dock/issues/87
198+
RUN find /usr/local/rake-compiler/ruby/*/*/lib/ruby/3.2.0 -name rbconfig.rb | \
199+
while read f ; do sed -i 's/\["EXTDLDFLAGS"\] = "/&-Wl,-flat_namespace /' $f ; done
200+
<% end %>
201+
193202
##
194203
## Final adjustments
195204
##
@@ -218,9 +227,6 @@ RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc
218227
# Add prefixed versions of compiler tools
219228
RUN for f in addr2line gcc gcov-tool ranlib ar dwp gcc-ranlib nm readelf as elfedit gcc-ar gprof objcopy size c++filt g++ gcov ld objdump strings cpp gcc-nm pkg-config strip ; do ln -sf $DEVTOOLSET_ROOTPATH/usr/bin/$f $DEVTOOLSET_ROOTPATH/usr/bin/<%= target %>-$f ; done
220229

221-
# ruby-2.5 links to libcrypt, which isn't necessary for extensions
222-
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
223-
224230
# Use builtin functions of newer gcc to avoid linker issues on Musl based Linux
225231
COPY build/math_h.patch /root/
226232
RUN cd /usr/include/ && \

test/rcd_test/ext/mri/extconf.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@
7979
##
8080
## This returns us to the symbol resolution we had in previous Rubies. It feels gross but may
8181
## be a workaround for gem maintainers until we all figure out a better way to deal with this.
82-
extdldflags = RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"].split
83-
if found = extdldflags.index("-bundle_loader")
84-
removed_1 = extdldflags.delete_at(found) # flag
85-
removed_2 = extdldflags.delete_at(found) # and its argument
86-
puts "Removing '#{removed_1} #{removed_2}' from EXTDLDFLAGS"
87-
end
88-
RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"] = extdldflags.join(" ")
82+
#
83+
# extdldflags = RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"].split
84+
# if found = extdldflags.index("-bundle_loader")
85+
# removed_1 = extdldflags.delete_at(found) # flag
86+
# removed_2 = extdldflags.delete_at(found) # and its argument
87+
# puts "Removing '#{removed_1} #{removed_2}' from EXTDLDFLAGS"
88+
# end
89+
# RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"] = extdldflags.join(" ")
90+
#
8991
end
9092
end
9193

0 commit comments

Comments
 (0)