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

move x86_64-linux to be based on ubuntu:20.04 #126

Merged
merged 5 commits into from
Aug 21, 2024
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
59 changes: 9 additions & 50 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
<%
image = case platform
when /x86_64-linux-gnu/ then "quay.io/pypa/manylinux2014_x86_64"
when /x86-linux-gnu/ then "quay.io/pypa/manylinux2014_i686"
else "ubuntu:20.04"
end
manylinux = !!(image =~ /manylinux/)
%>
<% image = "ubuntu:20.04" %>
FROM <%= image %>

##
## Install required base packages for compiling ruby
##
<% if manylinux %>
RUN yum install -y sudo ruby less git wget curl autoconf libtool cmake gcc-c++ xz readline-devel sqlite-devel openssl-devel libffi-devel libyaml-devel

## Prepare sudo
RUN rm -f /usr/local/bin/sudo && \
groupadd -r sudo && \
echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers

<% else %>
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get install -y sudo wget curl git-core build-essential xz-utils unzip dirmngr && \
apt-get install -y autoconf cmake pkg-config zlib1g-dev libreadline-dev libsqlite0-dev libssl-dev libyaml-dev libffi-dev && \
rm -rf /var/lib/apt/lists/*
<% end %>


##
## install rbenv and ruby-build
Expand Down Expand Up @@ -68,23 +50,18 @@ RUN dpkg -i /debs/*.deb
COPY build/mk_musl_cross.sh /tmp
RUN /tmp/mk_musl_cross.sh <%= target %>

<% elsif !manylinux %>
<% else %>
RUN apt-get -y update && \
apt-get install -y <%
if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
if platform =~ /x86-linux-gnu/ %> gcc-i686-linux-gnu g++-i686-linux-gnu <% end %><%
if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
rm -rf /var/lib/apt/lists/*
<% end %>

<% if manylinux %>
# Create dev tools x86-linux-*
COPY build/mk_i686.rb /root/
RUN /root/mk_i686.rb
<% end %>

<% if platform =~ /darwin/ %>
COPY build/mk_osxcross.sh /tmp
RUN /tmp/mk_osxcross.sh
Expand Down Expand Up @@ -171,7 +148,7 @@ RUN bash -c " \
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static -lpthread -lrt -ldl <% if platform =~ /x86/ %> -lcrypt <% end %>/' $f ; done
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static -lpthread -lrt -ldl <% if platform =~ /x86_64/ %> -lcrypt <% if platform !~ /musl/ %> -lz <% end %> <% end %>/' $f ; done
<% end %>

<% if platform =~ /mingw/ %>
Expand Down Expand Up @@ -221,24 +198,6 @@ RUN mv /opt/osxcross/target/bin/<%= target %>-strip /opt/osxcross/target/bin/<%=
ln /root/strip_wrapper_codesign /opt/osxcross/target/bin/<%= target %>-strip
<% end %>

<% if manylinux %>
# Enable modern compiler toolset of manylinux image
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 strip ; do ln -sf $DEVTOOLSET_ROOTPATH/usr/bin/$f $DEVTOOLSET_ROOTPATH/usr/bin/<%= target %>-$f ; done

# Use builtin functions of newer gcc to avoid linker issues on Musl based Linux
# TODO: remove in v1.6.0 once musl builds have been out for full minor release cycle, see 864be5b2
COPY build/math_h.patch /root/
RUN cd /usr/include/ && \
patch -p1 < /root/math_h.patch

# Update pkg-config because the distro ships 0.27.1 which is old and has bugs and performance issues.
COPY build/mk_pkg_config.sh /root/
RUN /root/mk_pkg_config.sh
<% end %>

<% if platform =~ /arm64-darwin/ %>
# Add a arm64 darwin target as alternative to aarch64
RUN grep -E 'rbconfig-aarch64-darwin' /usr/local/rake-compiler/config.yml | sed 's/rbconfig-[a-z0-9_]*-darwin/rbconfig-<%= platform %>/' >> /usr/local/rake-compiler/config.yml
Expand All @@ -258,6 +217,6 @@ COPY build/sudoers /etc/sudoers.d/rake-compiler-dock

RUN bash -c "rbenv global 3.1.3"

ENV RUBY_CC_VERSION 3.3.0:3.2.0:3.1.0:3.0.0:2.7.0:2.6.0:2.5.0:2.4.0
ENV RUBY_CC_VERSION=3.3.0:3.2.0:3.1.0:3.0.0:2.7.0:2.6.0:2.5.0:2.4.0

CMD bash
9 changes: 9 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# `rake-compiler/rake-compiler-dock` Changelog

## next / unreleased

### Notable changes

#### Standardizing Linux build images on Ubuntu base

Changed the base image of `x86_64-linux-gnu` and `x86-linux-gnu` images from `manylinux2014` to `ubuntu:20.04`, unifying all the builds are the same base image. See https://github.com/rake-compiler/rake-compiler-dock/issues/122 for more context.


## 1.5.1 / 2024-06-03

### Improvements
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ platforms = [
["arm64-darwin", "aarch64-apple-darwin"],
["x64-mingw-ucrt", "x86_64-w64-mingw32"],
["x64-mingw32", "x86_64-w64-mingw32"],
["x86-linux-gnu", "i686-redhat-linux-gnu"],
["x86-linux-gnu", "i686-linux-gnu"],
["x86-linux-musl", "i686-unknown-linux-musl"],
["x86-mingw32", "i686-w64-mingw32"],
["x86_64-darwin", "x86_64-apple-darwin"],
["x86_64-linux-gnu", "x86_64-redhat-linux-gnu"],
["x86_64-linux-gnu", "x86_64-linux-gnu"],
["x86_64-linux-musl", "x86_64-unknown-linux-musl"],
]

Expand Down
189 changes: 0 additions & 189 deletions build/math_h.patch

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_environment_variables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def rcd_env
unless IS_JRUBY
def test_RUBY_CC_VERSION
df = File.read(File.expand_path("../../Dockerfile.mri.erb", __FILE__))
df =~ /^ENV RUBY_CC_VERSION\s+(.*)\s+$/
df =~ /^ENV RUBY_CC_VERSION=(.*)$/
assert_equal $1, rcd_env['RUBY_CC_VERSION']
end

Expand Down