Skip to content

Commit a0bfaee

Browse files
committed
Pin CMake in builder image
The builder image previously used the distro CMake package, which left the version dependent on manylinux and yum repository state. That made the CMake backend harder to reason about across architectures. Install the official Kitware CMake 4.3.3 binary tarball in a shared stage instead. The stage verifies the architecture-specific SHA-256 before extracting it, and both the LLVM builder and final image use the pinned CMake from /opt/cmake. Signed-off-by: Eric Shi <ershi@nvidia.com>
1 parent a63a952 commit a0bfaee

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

docker/warp-builder/Dockerfile

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,42 @@ RUN CUDA_MAJOR=$(echo ${CUDA_VERSION} | cut -d. -f1) && \
5555
--component $component || exit 1; \
5656
done
5757

58+
# Install pinned CMake from official Kitware binary tarballs.
59+
FROM base AS cmake-installer
60+
61+
ARG CMAKE_VERSION=4.3.3
62+
63+
RUN ARCH=$(uname -m) && \
64+
if [ "$ARCH" = "x86_64" ]; then \
65+
CMAKE_ARCH="x86_64"; \
66+
CMAKE_SHA256="927b2368a946c37269c3a66225ab00544e756459cdd0b5d0da438694fb9ff802"; \
67+
elif [ "$ARCH" = "aarch64" ]; then \
68+
CMAKE_ARCH="aarch64"; \
69+
CMAKE_SHA256="9ea38356dbd3e32e51029a3e09a0f2f8e117ef4fbcaad7a21ffb36409bbd5cb4"; \
70+
else \
71+
echo "Unsupported architecture: $ARCH" && exit 1; \
72+
fi && \
73+
CMAKE_FILE="cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}.tar.gz" && \
74+
wget --max-redirect=1 "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE}" && \
75+
echo "${CMAKE_SHA256} ${CMAKE_FILE}" | sha256sum -c - && \
76+
mkdir -p /opt/cmake && \
77+
tar -xzf "${CMAKE_FILE}" --strip-components=1 -C /opt/cmake && \
78+
rm "${CMAKE_FILE}" && \
79+
/opt/cmake/bin/cmake --version
80+
5881
# Build LLVM from source
5982
FROM base AS llvm-builder
6083
WORKDIR /tmp/llvm-build
6184

6285
ARG TARGETARCH
6386

87+
COPY --from=cmake-installer /opt/cmake /opt/cmake
88+
ENV PATH=/opt/cmake/bin:${PATH}
89+
6490
# Install build tools needed for LLVM (not needed in final image)
6591
RUN yum install -y \
6692
git \
6793
unzip \
68-
cmake \
6994
&& yum clean all
7095

7196
# Install modern Ninja from GitHub releases (yum's ninja-build is too old for LLVM 21.1.0)
@@ -282,15 +307,13 @@ FROM base AS final
282307
ARG CUDA_VERSION
283308
ARG TARGETARCH
284309

285-
# Install build tools needed by Warp's CMake backend.
286-
RUN yum install -y \
287-
cmake \
288-
&& yum clean all
289-
290310
# Copy CUDA installation from builder stage
291311
# parse_redist.py creates /opt/cuda/linux-${TARGETARCH}/ structure (e.g., linux-x86_64, linux-aarch64)
292312
COPY --from=cuda-installer /opt/cuda/linux-${TARGETARCH} /usr/local/cuda
293313

314+
# Copy the pinned CMake binary distribution from Kitware.
315+
COPY --from=cmake-installer /opt/cmake /opt/cmake
316+
294317
# Copy LLVM installation from builder stage
295318
COPY --from=llvm-builder /opt/llvm /opt/llvm
296319

@@ -313,7 +336,7 @@ RUN mkdir -p /usr/local/cuda/licenses && \
313336
echo "See: https://docs.nvidia.com/cuda/eula/" >> /usr/local/cuda/licenses/README.txt
314337

315338
# Set environment variables
316-
ENV PATH=/usr/local/cuda/bin:/opt/llvm/bin:${PATH}
339+
ENV PATH=/opt/cmake/bin:/usr/local/cuda/bin:/opt/llvm/bin:${PATH}
317340
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib:/opt/llvm/lib:${LD_LIBRARY_PATH}
318341
ENV CUDA_HOME=/usr/local/cuda
319342
ENV CUDA_PATH=/usr/local/cuda

0 commit comments

Comments
 (0)