From 020bc7adda05fa89e5aa4896fa749c2819bba953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Wed, 24 Jan 2024 10:21:07 +0100 Subject: [PATCH] Docker/build: allow for using gcc-snapshot for building nightlies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Dockerfile | 10 +++++++++- build/build.sh | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index df228b5..a472cd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ @@ -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 diff --git a/build/build.sh b/build/build.sh index f9fd3b0..8fad2ac 100755 --- a/build/build.sh +++ b/build/build.sh @@ -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