I am trying to install gcc13 and g++13 in the following Rust docker image.
# Builder
FROM rust:1-bookworm AS builder
RUN apt update
RUN apt install software-properties-common -y
RUN apt-get install python3-launchpadlib -y
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y
RUN apt update
RUN apt install -y clang g++-13 gcc-13
Since gcc13 is not natively available in debian bookworm, I already tried using method like using ppa:ubuntu-toolchain-r/test
as describe here.
However, I’m still getting the error E: Unable to locate package g++-13
and E: Unable to locate package g++-13
. Any ideas what I have done wrong?
2
Answers
Option 1: Alpine
You can use an Alpine base image.
In this case you’ll immediately have access to GCC 13.
Option 2: Install onto Debian
If you really want an image based on Debian Bookworm then you can install GCC 13 from source. It’s a bit of a slog because the build takes a while.
For those who are trying to install gcc13 and g++13 in Debian 12, try to download the tar.gz file and extract it
https://gcc.gnu.org/pub/gcc/releases/gcc-13.2.0/
Run the following commands inside of the extracted folder:
If you type
g++ --version
, it should look like this