Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darwin: work around the Ruby 3.2 symbol resolution changes #94

Merged
merged 2 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed
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
<% end %>

# ruby-2.5 links to libcrypt, which isn't necessary for extensions
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done

<% if platform=~/darwin/ %>
# ruby-3.2 on darwin links with `-bundle_loader`, see https://github.com/rake-compiler/rake-compiler-dock/issues/87
RUN find /usr/local/rake-compiler/ruby/*/*/lib/ruby/3.2.0 -name rbconfig.rb | \
while read f ; do sed -i 's/\["EXTDLDFLAGS"\] = "/&-Wl,-flat_namespace /' $f ; done
<% end %>

##
## Final adjustments
##
Expand Down Expand Up @@ -218,9 +227,6 @@ RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc
# Add prefixed versions of compiler tools
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

# ruby-2.5 links to libcrypt, which isn't necessary for extensions
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done

# Use builtin functions of newer gcc to avoid linker issues on Musl based Linux
COPY build/math_h.patch /root/
RUN cd /usr/include/ && \
Expand Down
16 changes: 9 additions & 7 deletions test/rcd_test/ext/mri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@
##
## This returns us to the symbol resolution we had in previous Rubies. It feels gross but may
## be a workaround for gem maintainers until we all figure out a better way to deal with this.
extdldflags = RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"].split
if found = extdldflags.index("-bundle_loader")
removed_1 = extdldflags.delete_at(found) # flag
removed_2 = extdldflags.delete_at(found) # and its argument
puts "Removing '#{removed_1} #{removed_2}' from EXTDLDFLAGS"
end
RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"] = extdldflags.join(" ")
#
# extdldflags = RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"].split
# if found = extdldflags.index("-bundle_loader")
# removed_1 = extdldflags.delete_at(found) # flag
# removed_2 = extdldflags.delete_at(found) # and its argument
# puts "Removing '#{removed_1} #{removed_2}' from EXTDLDFLAGS"
# end
# RbConfig::MAKEFILE_CONFIG["EXTDLDFLAGS"] = extdldflags.join(" ")
#
end
end

Expand Down