Skip to content

Commit 6e1c6b7

Browse files
committed
fix: use -Wl,-flat_namespace for any ruby using -bundle_loader
It looks like -bundle-loader was backported to 2.7.7, 3.0.5, and 3.1.3 in addition to being present in 3.2 and later.
1 parent fa86c00 commit 6e1c6b7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Dockerfile.mri.erb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,15 @@ RUN find /usr/local/rake-compiler/ruby -name lib*-ruby*.dll.a | while read f ; d
167167
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
168168

169169
<% if platform =~ /darwin/ %>
170-
# ruby-3.2+ on darwin links with `-bundle_loader`,
171-
# - see https://github.com/rake-compiler/rake-compiler-dock/issues/87
172-
# - note that we do this for "3.[2-9].*" to match rubies 3.2 and later
173-
# - and we use a "*" on the end instead of a digit to match prereleases like "3.3.0+0"
174-
RUN find /usr/local/rake-compiler/ruby/*/*/lib/ruby/3.[2-9].* -name rbconfig.rb | \
175-
while read f ; do sed -i 's/\["EXTDLDFLAGS"\] = "/&-Wl,-flat_namespace /' $f ; done
170+
# for rubies which use `-bundle_loader` on darwin
171+
# - the upstream change: https://github.com/ruby/ruby/pull/6193
172+
# - how we got to this solution: https://github.com/rake-compiler/rake-compiler-dock/issues/87
173+
#
174+
# note that ruby/ruby#6193 was backported to 2.7.7, 3.0.5, and 3.1.3
175+
# - see https://github.com/rake-compiler/rake-compiler-dock/issues/134 for more notes
176+
RUN find /usr/local/rake-compiler/ruby/*/*/lib/ruby -name rbconfig.rb | while read f ; do \
177+
sed -i 's/\["EXTDLDFLAGS"\] = ".*-bundle_loader/& -Wl,-flat_namespace/' $f ; \
178+
done
176179
<% end %>
177180
178181

0 commit comments

Comments
 (0)