Skip to content

Commit 1972edf

Browse files
authored
Pre-install all CI compilers in base Docker image (#7879)
Pre-install GCC 11, GCC 13, GCC 14, clang 15, and clang 18 in the base image so that the setup-linux action only needs to activate the right compiler instead of downloading/installing at runtime. This reduces CI job latency and removes fragile S3/dnf dependencies from the critical path. Also register clang runtime library directories with ldconfig so that libclang_rt.asan.so is discoverable by the linker without LD_LIBRARY_PATH workarounds in CI scripts.
1 parent 30f1069 commit 1972edf

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

docker/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,45 @@ RUN dnf install -y \
2929
&& dnf clean all \
3030
&& rm -rf /var/cache/dnf
3131

32+
# Install GCC toolset versions needed by CI.
33+
# The manylinux_2_28 base image (AlmaLinux 8) ships with GCC 8 as the system
34+
# default and bundles gcc-toolset-12 under /usr/local/bin. Install the
35+
# additional toolset versions that PyTorch CI requires.
36+
RUN dnf install -y \
37+
gcc-toolset-11-gcc \
38+
gcc-toolset-11-gcc-c++ \
39+
gcc-toolset-11-gcc-gfortran \
40+
gcc-toolset-13-gcc \
41+
gcc-toolset-13-gcc-c++ \
42+
gcc-toolset-13-gcc-gfortran \
43+
gcc-toolset-14-gcc \
44+
gcc-toolset-14-gcc-c++ \
45+
gcc-toolset-14-gcc-gfortran \
46+
&& dnf clean all \
47+
&& rm -rf /var/cache/dnf
48+
49+
# Install pre-built clang 15 and 18 (clang 20 is already the system default)
50+
RUN ARCH=$(uname -m) && PLATFORM="linux-${ARCH}" && \
51+
for CLANG_VERSION in 15 18; do \
52+
S3_URL="https://gha-artifacts.s3.amazonaws.com/clang/${PLATFORM}/clang-${CLANG_VERSION}/clang-${CLANG_VERSION}-${PLATFORM}.tar.gz" && \
53+
INSTALL_DIR="/opt/clang-${CLANG_VERSION}" && \
54+
echo "Installing clang ${CLANG_VERSION} from ${S3_URL}" && \
55+
curl -fsSL "${S3_URL}" -o /tmp/clang.tar.gz && \
56+
mkdir -p "${INSTALL_DIR}" && \
57+
tar xzf /tmp/clang.tar.gz -C "${INSTALL_DIR}" --strip-components=1 && \
58+
rm -f /tmp/clang.tar.gz; \
59+
done
60+
61+
# Register clang runtime library directories so the linker can find libclang_rt.asan.so
62+
# etc. without needing LD_LIBRARY_PATH hacks at CI time.
63+
RUN for CLANG_VERSION in 15 18; do \
64+
INSTALL_DIR="/opt/clang-${CLANG_VERSION}" && \
65+
CLANG_RT_DIR=$("${INSTALL_DIR}/bin/clang" --print-runtime-dir 2>/dev/null || true) && \
66+
if [ -n "${CLANG_RT_DIR}" ] && [ -d "${CLANG_RT_DIR}" ]; then \
67+
echo "${CLANG_RT_DIR}" > "/etc/ld.so.conf.d/clang-${CLANG_VERSION}.conf"; \
68+
fi; \
69+
done && ldconfig
70+
3271
# Install uv (Python package manager) — needed before CUDA install for uv run
3372
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
3473
ENV PATH="/root/.local/bin:${PATH}"

0 commit comments

Comments
 (0)