A high-throughput and memory-efficient inference and serving engine for LLMs
[Build] Upgrade CUDA Dockerfiles from GCC 10 to GCC 12 for C++20 compatibility (#44923)
Signed-off-by: Richard Barnes <rbarnes@meta.com> Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
Richard Barnes committed
Jun 11, 2026 at 08:26 UTC
05d9848267032dec99a3520a57083ef61b02f19d
4 files changed
+27
-9
CMakeLists.txt
+8
@@ -20,6 +20,14 @@ set(CMAKE_CUDA_STANDARD_REQUIRED ON)
20
set(CMAKE_HIP_STANDARD 20)
21
set(CMAKE_HIP_STANDARD_REQUIRED ON)
22
23
+# PyTorch headers require C++20; GCC < 11.3 has incomplete C++20 support.
24
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.3")
25
+ message(FATAL_ERROR
26
+ "GCC >= 11.3 is required to build vLLM (found ${CMAKE_CXX_COMPILER_VERSION}). "
27
+ "PyTorch's C++20 headers require a compiler with full C++20 support. "
28
+ "See: https://github.com/pytorch/pytorch/pull/167929")
29
+endif()
30
+
31
32
# CUDA by default, can be overridden by using -DVLLM_TARGET_DEVICE=... (used by setup.py)
33
set(VLLM_TARGET_DEVICE "cuda" CACHE STRING "Target device backend for vLLM")
docker/Dockerfile
+7
-5
@@ -148,11 +148,13 @@ RUN if [ "${BUILD_OS}" = "manylinux" ]; then \
148
sudo \
149
python3-pip \
150
libibverbs-dev \
151
- # Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
152
- # as it was causing spam when compiling the CUTLASS kernels
153
- gcc-10 \
154
- g++-10 \
155
- && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 110 --slave /usr/bin/g++ g++ /usr/bin/g++-10 \
151
+ # GCC 10 was previously pinned to suppress spurious -Wredundant-move warnings
152
+ # from CUTLASS (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519). That bug
153
+ # was fixed in GCC 11. GCC >= 11.3 is now required because PyTorch's C++20 headers
154
+ # (pytorch/pytorch#167929) are not compatible with GCC < 11.3.
155
+ gcc-11 \
156
+ g++-11 \
157
+ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 \
158
# Install python dev headers if available (needed for cmake FindPython on Ubuntu 24.04
159
# which ships cmake 3.28 and requires Development.SABIModule; silently skipped on
160
# Ubuntu 20.04/22.04 where python3.x-dev is not available without a PPA)
docker/Dockerfile.nightly_torch
+3
-4
@@ -42,10 +42,9 @@ RUN --mount=type=cache,target=/root/.cache/uv \
42
# Reference: https://github.com/astral-sh/uv/pull/1694
43
ENV UV_HTTP_TIMEOUT=500
44
45
-# Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
46
-# as it was causing spam when compiling the CUTLASS kernels
47
-RUN apt-get install -y gcc-10 g++-10
48
-RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 110 --slave /usr/bin/g++ g++ /usr/bin/g++-10
45
+# GCC >= 11.3 required for PyTorch C++20 headers (pytorch/pytorch#167929).
46
+RUN apt-get install -y gcc-11 g++-11
47
+RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11
48
RUN <<EOF
49
gcc --version
50
EOF
docs/getting_started/installation/gpu.cuda.inc.md
+9
@@ -139,6 +139,15 @@ You can find more information about vLLM's wheels in [Install the latest code](#
139
140
#### Full build (with compilation) {#full-build}
141
142
+!!! note "Compiler requirement"
143
+ Building from source requires GCC/G++ ≥ 11.3. PyTorch's C++20 headers are
144
+ not compatible with GCC 10 or GCC < 11.3. On Ubuntu 22.04:
145
+ ```bash
146
+ sudo apt-get install -y gcc-11 g++-11
147
+ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \
148
+ --slave /usr/bin/g++ g++ /usr/bin/g++-11
149
+ ```
150
+
151
If you want to modify C++ or CUDA code, you'll need to build vLLM from source. This can take several minutes:
152
153
```bash