Skip to content

Commit a1c93a0

Browse files
authored
Lower linux glibc requirement from 2.31 to 2.28 (#575)
In componentize-py Joel's building custom wasi-sdk binaries for more Linux compat which is what maturin, the build tool use there, desires. I don't think there's a concrete reason to have a higher Linux version here, so let's lower it in wasi-sdk itself. This commit switches the build container from Ubuntu 20.04 (glibc 2.31) to AlmaLinux 8 (glibc 2.28). The AlmaLinux container is what Wasmtime uses, for example, and has supported security updates to 2029 and is I believe intended to be used for purposes such as this.
1 parent 0599c9f commit a1c93a0

File tree

2 files changed

+44
-18
lines changed

2 files changed

+44
-18
lines changed

ci/docker/Dockerfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
11
# Use a relatively old/stable distro here to maximize the supported platforms
22
# and avoid depending on more recent version of, say, libc.
3-
# Here we choose Ubuntu 20.04.
3+
# Here we choose AlmaLinux 8
44

5-
FROM ubuntu:20.04
5+
FROM almalinux:8
66

77
# Various build tooling and such necessary to build LLVM and a wasi-sysroot
8-
RUN apt-get update \
9-
&& apt-get install -y --no-install-recommends \
10-
ccache \
8+
RUN dnf install -y \
119
curl \
1210
ca-certificates \
13-
build-essential \
1411
clang \
1512
python3 \
1613
git \
1714
unzip \
18-
xz-utils
15+
cmake
1916

20-
# Install a more recent version of CMake than what 18.04 has since that's what
21-
# LLVM requires.
22-
RUN ARCH=$(uname -m) \
23-
&& curl -sSLO https://github.com/Kitware/CMake/releases/download/v3.29.5/cmake-3.29.5-linux-${ARCH}.tar.gz \
24-
&& tar xf cmake-3.29.5-linux-${ARCH}.tar.gz \
25-
&& rm cmake-3.29.5-linux-${ARCH}.tar.gz \
26-
&& mkdir -p /opt \
27-
&& mv cmake-3.29.5-linux-${ARCH} /opt/cmake
17+
COPY ./install-ccache.sh .
18+
RUN ./install-ccache.sh
2819

29-
ENV PATH /opt/cmake/bin:$PATH
20+
ENV PATH /opt/ccache/bin:$PATH
3021

31-
# As with CMake install a later version of Ninja than waht 18.04 has.
22+
# AlmaLinux 8 doesn't seem to have ninja, so install it manually.
3223
RUN ARCH=$(uname -m) \
3324
&& if [ "$ARCH" = "aarch64" ]; then SUFFIX=-aarch64; fi \
3425
&& curl -sSL -o ninja.zip https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux${SUFFIX}.zip \
3526
&& unzip ninja.zip \
3627
&& rm *.zip \
37-
&& mv ninja /opt/cmake/bin
28+
&& mv ninja /opt/ccache/bin
3829

3930
# Tell programs to cache in a location that both isn't a `--volume` mounted root
4031
# and isn't `/root` in the container as that won't be writable during the build.

ci/docker/install-ccache.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# AlmaLinux 8, the container this script runs in, does not have ccache in its
4+
# package repositories. The ccache project publishes both x86_64 and aarch64
5+
# binaries, however. The x86_64 binaries for ccache are themselves built in
6+
# AlmaLinux 8 so they're compatible, but the aarch64 binaries are built in a
7+
# newer container and don't run on AlmaLinux 8.
8+
#
9+
# Thus this script downloads precompiled binaries for x86_64 but builds from
10+
# source on aarch64.
11+
12+
ARCH=$(uname -m)
13+
ver=4.12.1
14+
15+
if [ "x$ARCH" = "x86_64" ]; then
16+
curl -sSLO https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}-linux-${ARCH}.tar.xz
17+
tar -xf ccache-${ver}-linux-${ARCH}.tar.xz
18+
rm ccache-${ver}-linux-${ARCH}.tar.xz
19+
mv ccache-${ver}-linux-${ARCH} /opt/ccache/bin
20+
else
21+
curl -sSLO https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}.tar.xz
22+
tar -xf ccache-${ver}.tar.xz
23+
24+
cd ccache-${ver}
25+
mkdir build
26+
cd build
27+
cmake .. \
28+
-DCMAKE_INSTALL_PREFIX=/opt/ccache \
29+
-DCMAKE_BUILD_TYPE=Release \
30+
-DHTTP_STORAGE_BACKEND=OFF \
31+
-DENABLE_TESTING=OFF \
32+
-DREDIS_STORAGE_BACKEND=OFF
33+
make -j$(nproc)
34+
make install
35+
fi

0 commit comments

Comments
 (0)