Skip to content

Commit

Permalink
stop building rubies with -j
Browse files Browse the repository at this point in the history
builds are failing too often due to
https://bugs.ruby-lang.org/issues/18506, so let's opt for simple and
debuggable. we'll run the builds in parallel with XRUBIES, but won't
parallelize each build with `-j`.
  • Loading branch information
flavorjones committed Nov 25, 2023
1 parent de794f2 commit e12ef8c
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
Expand Up @@ -132,40 +132,44 @@ RUN bash -c " \
"

<%
#
# Build ruby versions prior to ruby2_keywords using ruby-2.5
# Build ruby versions with ruby2_keywords using ruby-3.x
#
# Note that parallel builds of ruby with make flag `-j` are often flaky, see
# https://bugs.ruby-lang.org/issues/18506
#
axrubies = if platform =~ /x64-mingw-ucrt/
[
# Rubyinstaller-3.1.0+ is platform x64-mingw-ucrt
["3.3.0-preview3:3.2.0:3.1.0", "3.1.3", true],
["3.1.0:3.2.0:3.3.0-preview3", "3.1.3"],
]
elsif platform =~ /x64-mingw32/
[
# Rubyinstaller prior to 3.1.0 is platform x64-mingw32
["2.6.0:2.5.0:2.4.0", "2.5.9", false],
["3.0.0:2.7.0", "3.1.3", true],
["2.4.0:2.5.0:2.6.0", "2.5.9"],
["2.7.0:3.0.0", "3.1.3", true],
]
else
[
# Build xruby versions prior ruby2_keywords in parallel using ruby-2.5
["2.6.0:2.5.0:2.4.0", "2.5.9", false],
# Build xruby versions with ruby2_keywords in parallel using ruby-3.x
["3.3.0-preview3:3.2.0:3.1.0:3.0.0:2.7.0", "3.1.3", true],
["2.4.0:2.5.0:2.6.0", "2.5.9"],
["2.7.0:3.0.0:3.1.0:3.2.0:3.3.0-preview3", "3.1.3"],
]
end

axrubies.each do |xrubies, rvm, parallel| %>
axrubies.each do |xrubies, rvm| %>
ENV XRUBIES <%= xrubies %>
<% strip = '-s' if platform !~ /darwin/ %>
# Build xruby versions in parallel
# Then cleanup all build artifacts
# Build xruby versions, then cleanup all build artifacts
RUN bash -c " \
rvm use <%= rvm %> && \
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform=~/x64-mingw-ucrt/ %>' && \
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
export LDFLAGS='-pipe <%= strip %>' && \
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
export MAKE='make V=1 <%= "-j`nproc`" if parallel %>' && \
export MAKE='make V=1 && \
rake-compiler cross-ruby VERSION=$XRUBIES HOST=<%= target %> && \
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources && \
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw \
Expand Down

0 comments on commit e12ef8c

Please sign in to comment.