Hey @MikeS,
I tried it locally (I use a newer GCC from time to time due to C++ support as well) and following the GNU Project instructions it worked well. Note that it can take a while to build.
FROM debian:bookworm-slim AS build
ENV GCC_VERSION=gcc-14.2.0
ENV GCC_URL=https://ftp.gnu.org/gnu/gcc/${GCC_VERSION}/${GCC_VERSION}.tar.gz
ENV LD_LIBRARY_PATH="/usr/local/gcc-14/lib64"
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
wget \
curl \
git \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
flex \
bison \
libisl-dev \
zlib1g-dev \
libzstd-dev \
libatomic1 \
libgcc-12-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/src/gcc && \
cd /usr/src/gcc && \
wget ${GCC_URL} && \
tar -xf ${GCC_VERSION}.tar.gz && \
rm ${GCC_VERSION}.tar.gz
RUN cd /usr/src/gcc/${GCC_VERSION} && \
./contrib/download_prerequisites && \
mkdir build && cd build && \
../configure --prefix=/usr/local/gcc-14 --enable-languages=c,c++ --disable-multilib && \
make -j$(nproc) && \
make install
FROM debian:bookworm-slim AS release
ENV PATH="/usr/local/gcc-14/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/gcc-14/lib64"
COPY --from=build /usr/local/gcc-14 /usr/local/gcc-14
RUN apt-get update && apt-get install -y --no-install-recommends \
libgmp10 \
libmpfr6 \
libmpc3 \
libisl23 \
libatomic1 \
zlib1g \
libzstd1 \
libgcc-s1 \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*