Skip to content

Commit

Permalink
Docker/build: allow for using gcc-snapshot for building nightlies
Browse files Browse the repository at this point in the history
Nightlies with GNAT enabled need a matching base compiler. Usually, the
previous release is not fresh enough, so we pull a snapshot in the
docker image. We need to bump the snapshot when GNAT does not build
anymore.

Signed-off-by: Marc Poulhiès <[email protected]>
  • Loading branch information
dkm committed Jan 24, 2024
1 parent 30fe1b4 commit 020bc7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ RUN mkdir -p /opt && mkdir -p /home/gcc-user && useradd gcc-user && chown gcc-us

RUN apt-get clean -y && apt-get check -y

## for nightly build of cross compiler with GNAT (Ada), we need "a matching"
## compiler. So using gcc-13 for master is not working. So we have a *hardcoded*
## snapshot below that should be "good enough". When there's a failure caused by
## GNAT, it's probably time to bump the snapshot.

RUN apt-get update -y -q && apt-get upgrade -y -q && apt-get upgrade -y -q && \
apt-get install -y -q \
autoconf \
Expand Down Expand Up @@ -54,10 +59,13 @@ RUN apt-get update -y -q && apt-get upgrade -y -q && apt-get upgrade -y -q && \
curl "https://compiler-explorer.s3.amazonaws.com/opt/gcc-11.4.0.tar.xz" -o gcc11.tar.xz && \
curl "https://compiler-explorer.s3.amazonaws.com/opt/gcc-12.3.0.tar.xz" -o gcc12.tar.xz && \
curl "https://compiler-explorer.s3.amazonaws.com/opt/gcc-13.2.0.tar.xz" -o gcc13.tar.xz && \
curl "https://s3.amazonaws.com/compiler-explorer/opt/gcc-trunk-20240122.tar.xz" -o "gcc-snapshot.tar.xz" && \
tar Jxvf gcc11.tar.xz && \
tar Jxvf gcc12.tar.xz && \
tar Jxvf gcc13.tar.xz && \
rm gcc11.tar.xz gcc12.tar.xz gcc13.tar.xz
tar Jxvf gcc-snapshot.tar.xz && \
mv gcc-trunk-20240122 gcc-trunk && \
rm gcc11.tar.xz gcc12.tar.xz gcc13.tar.xz gcc-snapshot.tar.xz

## Need for host GCC version to be ~= latest cross GCC being built.
## This is at least needed for building cross-GNAT (Ada) as the GNAT runtime has no
Expand Down
6 changes: 5 additions & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ fi
# We need to pick one as close as possible to the GCC version being built because of GNAT (Ada).
# It needs a matching compiler to build the runtime. Too old or too recent may cause build errors.

# Kind of heuristic to find a "good" GCC version. Not perfect, but should do the work
# Kind of heuristic to find a "good" GCC version. Not perfect, but should do the
# work. Starts by checking for a matching version host compiler X.Y.Z, then for
# any X.Y and finally for any X. If nothing matches, then it uses the default
# one (see Dockerfile).
# This works for X.Y.Z but also for "trunk".
V=${BASEVERSION}
for i in 1 2 3; do
F=0
Expand Down

0 comments on commit 020bc7a

Please sign in to comment.