Skip to content

Commit abfb5d1

Browse files
Upgrade to GCC 13 for full C++20 support
Ubuntu 22.04's default GCC 11 has incomplete C++20 support (constexpr std::string, std::ranges). Install GCC 13 from Ubuntu Toolchain PPA which has full C++20 support matching macOS/Clang behavior. Co-Authored-By: Claude (global.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
1 parent 47a7dfd commit abfb5d1

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

Dockerfile.Fibers

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ FROM ubuntu:22.04 AS base
55
ENV DEBIAN_FRONTEND=noninteractive
66

77
# Install necessary dependencies
8+
# Install GCC 13 from Ubuntu Toolchain PPA for full C++20 support
89
RUN apt-get update
910
RUN apt-get install -y software-properties-common
11+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
1012
RUN apt-get update
11-
RUN apt-get install -y build-essential python3 python3-distutils g++ make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
13+
RUN apt-get install -y build-essential python3 python3-distutils gcc-13 g++-13 make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
14+
15+
# Set GCC 13 as the default compiler
16+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
17+
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
1218

1319
# Copy local Node.js source into the image
1420
WORKDIR /usr/src/node

Dockerfile.Node24

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ ENV DEBIAN_FRONTEND=noninteractive
66

77
# Install necessary dependencies
88
# Ubuntu 22.04 has Python 3.10 which meets Node.js v24 requirement (3.9+)
9+
# Install GCC 13 from Ubuntu Toolchain PPA for full C++20 support
910
RUN apt-get update
1011
RUN apt-get install -y software-properties-common
11-
RUN apt-get update && apt-get install -y build-essential python3 python3-distutils g++ make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
12+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
13+
RUN apt-get update && apt-get install -y build-essential python3 python3-distutils gcc-13 g++-13 make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
1214
RUN rm -rf /var/lib/apt/lists/*
1315

16+
# Set GCC 13 as the default compiler
17+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
18+
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
19+
1420
# Copy local Node.js source into the image
1521
WORKDIR /usr/src/node
1622
COPY . .

Dockerfile.Packages

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ FROM ubuntu:22.04 AS base
55
ENV DEBIAN_FRONTEND=noninteractive
66

77
# Install necessary dependencies
8+
# Install GCC 13 from Ubuntu Toolchain PPA for full C++20 support
89
RUN apt-get update
910
RUN apt-get install -y software-properties-common
11+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
1012
RUN apt-get update
11-
RUN apt-get install -y build-essential python3 python3-distutils g++ make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
13+
RUN apt-get install -y build-essential python3 python3-distutils gcc-13 g++-13 make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
14+
15+
# Set GCC 13 as the default compiler
16+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
17+
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
1218

1319
# Copy local Node.js source into the image
1420
WORKDIR /usr/src/node

0 commit comments

Comments
 (0)