Skip to content

Commit

Permalink
Build releases on CentOS 7 (awslabs#517)
Browse files Browse the repository at this point in the history
This gets us compatibility back to glibc 2.17. The tricky part is that
CentOS 7 by default packages a GCC that's too old to build the CRT and a
Clang that's too old to run bindgen. But they also distribute optional
packages (devtoolsets) that update these toolchains and stick them in a
separate directory. So this change adopts those, and tweaks the
environment variables on the builder to point at the newer tools.

Signed-off-by: James Bornholt <[email protected]>
  • Loading branch information
jamesbornholt authored Sep 19, 2023
1 parent 171c420 commit 11def47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
20 changes: 15 additions & 5 deletions package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2
FROM public.ecr.aws/docker/library/centos:7

RUN amazon-linux-extras install -y epel
RUN yum install -y epel-release centos-release-scl
RUN yum install -y \
fuse \
fuse-devel \
make \
cmake3 \
clang \
git \
pkgconfig \
dpkg \
fakeroot \
rpmdevtools \
tar \
python3 \
wget && \
python3-pip \
wget \
devtoolset-10-gcc \
devtoolset-10-gcc-c++ \
llvm-toolset-7.0-clang \
&& \
yum clean all

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"

RUN wget -q "https://github.com/EmbarkStudios/cargo-about/releases/download/0.5.6/cargo-about-0.5.6-$(uname -p)-unknown-linux-musl.tar.gz" && \
wget -q "https://github.com/EmbarkStudios/cargo-about/releases/download/0.5.6/cargo-about-0.5.6-$(uname -p)-unknown-linux-musl.tar.gz.sha256" && \
Expand All @@ -28,5 +31,12 @@ RUN wget -q "https://github.com/EmbarkStudios/cargo-about/releases/download/0.5.
cp cargo-about-*/cargo-about /usr/bin && \
rm -rf cargo-about-* checksum.sha256

RUN python3 -m pip install dataclasses

ENV PATH="/opt/rh/llvm-toolset-7.0/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/root/.cargo/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/rh/llvm-toolset-7.0/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib"
ENV CC="/opt/rh/devtoolset-10/root/usr/bin/gcc"
ENV CXX="/opt/rh/devtoolset-10/root/usr/bin/g++"

WORKDIR /mountpoint
ENTRYPOINT ["/mountpoint/package/package.py"]
3 changes: 3 additions & 0 deletions package/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def build_mountpoint_binary(metadata: BuildMetadata, args: argparse.Namespace) -
if args.official:
# Remove the commit from the User-agent version number
env["MOUNTPOINT_S3_AWS_RELEASE"] = "true"
for var in ["CC", "CXX", "LD_LIBRARY_PATH"]:
if var in os.environ:
env[var] = os.environ[var]

# Build the binary
cmd = ["cargo", "build", "--bin", "mount-s3", "--release"]
Expand Down

0 comments on commit 11def47

Please sign in to comment.