Skip to content

Commit cf9eb33

Browse files
authored
chore: update to LLVM 21 (#26)
Updates the Windows Dockerfile to use LLVM 21. For the Linux Dockerfile we use both versions for now, i.e. LLVM 14 and 21, and at some later point will remove the LLVM 14 dependency entirely.
1 parent 6f51177 commit cf9eb33

File tree

2 files changed

+27
-50
lines changed

2 files changed

+27
-50
lines changed

linux/Dockerfile

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,54 @@ ARG DEBIAN_VERSION=bookworm
22
ARG BASE_IMAGE=debian:$DEBIAN_VERSION
33

44
FROM $BASE_IMAGE
5-
6-
# Make sure we are on root
75
USER root
86

9-
ARG RUST_VERSION=1.90
10-
ARG LLVM_VER=14
11-
12-
# Use the bullseye llvm version because there is no newer one yet
13-
ARG LLVM_DEBIAN_VERSION=bookworm
14-
157
# Avoid warnings by switching to noninteractive
168
ENV DEBIAN_FRONTEND=noninteractive
179

18-
RUN apt-get update \
19-
&& apt-get upgrade -y \
20-
&& apt-get install -y \
21-
apt-utils \
22-
git \
23-
wget gnupg curl \
24-
build-essential \
25-
libz-dev \
26-
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
27-
python3-venv
28-
29-
# dpkg --add-architecture arm64 \
10+
ARG LLVM_VERSION=21
11+
ARG RUST_VERSION=1.90
3012

31-
# # Setup llvm sources
32-
# RUN echo "deb http://apt.llvm.org/$LLVM_DEBIAN_VERSION/ llvm-toolchain-$LLVM_DEBIAN_VERSION-$LLVM_VER main" >> /etc/apt/sources.list.d/llvm.list
33-
# RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
13+
# Install LLVM and its dependencies
14+
RUN apt update \
15+
&& apt upgrade -y \
16+
&& apt install -y --no-install-recommends wget curl gnupg build-essential lsb-release software-properties-common \
17+
&& wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh $LLVM_VERSION \
18+
&& apt install -y --no-install-recommends clang lld liblld-$LLVM_VERSION-dev libpolly-$LLVM_VERSION-dev
3419

35-
#Install Clang dependencies
36-
#On bookworm clang is version 14, which is what we have as default.
37-
#Installing without versions here is convinient for scripts calling clang or lld instead of clang-14/lld-14
38-
RUN apt-get install -y zip clang lldb lld clangd \
39-
clang-$LLVM_VER lldb-$LLVM_VER lld-$LLVM_VER \
40-
clangd-$LLVM_VER liblld-$LLVM_VER-dev \
41-
llvm-$LLVM_VER-dev libpolly-$LLVM_VER-dev
20+
# TODO: Remove this once we completely switched over to LLVM 21
21+
RUN apt install -y zip clang lldb lld clangd clang-14 lldb-14 lld-14 clangd-14 liblld-14-dev llvm-14-dev libpolly-14-dev
4222

43-
# Install llvm-lit, which we use for correctness tests
44-
ENV XDG_BIN_HOME=/usr/local/bin
45-
# Download the latest installer
46-
ADD https://astral.sh/uv/install.sh /uv-installer.sh
47-
# Run the installer then remove it
48-
RUN sh /uv-installer.sh && rm /uv-installer.sh && mkdir -p /usr/local/uv
49-
ENV UV_TOOL_DIR="/usr/local/uv"
23+
# Install llvm-lit, used by our correctness tests
24+
COPY --from=ghcr.io/astral-sh/uv:0.9.17 /uv /uvx /bin/
5025
ENV UV_TOOL_BIN_DIR="/usr/local/bin/"
5126
RUN uv tool install lit
5227

28+
# Install Rust
5329
ENV CARGO_HOME=/usr/local/cargo
5430
ENV RUSTUP_HOME=/usr/local/rustup
55-
# Get Rust
31+
5632
RUN curl https://sh.rustup.rs -sSf | bash -s -- --profile minimal --default-toolchain none -y
5733
ENV PATH="${CARGO_HOME}/bin:${PATH}"
5834

5935
RUN rustup toolchain install $RUST_VERSION \
60-
&& rustup default $RUST_VERSION \
61-
&& rustup component add clippy rustfmt llvm-tools-preview \
62-
&& rustup target add aarch64-unknown-linux-gnu \
63-
&& rustup target add x86_64-unknown-linux-musl
64-
36+
&& rustup default $RUST_VERSION \
37+
&& rustup component add clippy rustfmt llvm-tools-preview \
38+
&& rustup target add aarch64-unknown-linux-gnu \
39+
&& rustup target add x86_64-unknown-linux-musl
6540

6641
RUN chmod -R a+rw $CARGO_HOME \
67-
&& chmod -R a+rw $RUSTUP_HOME \
68-
&& chmod -R a+rw /usr/local/uv \
69-
&& chmod -R a+rw /usr/local/bin
42+
&& chmod -R a+rw $RUSTUP_HOME \
43+
&& chmod -R a+rw /usr/local/bin
44+
45+
# Install cargo-binstall to make subsequent binaries easier to download
46+
RUN wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$(uname -m)-unknown-linux-musl.tgz \
47+
&& tar -xf cargo-binstall-$(uname -m)-unknown-linux-musl.tgz -C $CARGO_HOME/bin \
48+
&& rm cargo-binstall-*.tgz
7049

71-
#Install bininstall to make subsequent binaries easier to download
72-
RUN wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-`uname -m`-unknown-linux-musl.tgz && tar -xf cargo-binstall-`uname -m`-unknown-linux-musl.tgz -C $CARGO_HOME/bin
73-
#Install documentation and coverage tools
7450
RUN cargo binstall --no-confirm mdbook grcov cargo-nextest
7551

52+
# Configure container defaults for interactive use
7653
WORKDIR /build
7754
ENTRYPOINT ["bash"]
7855

windows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION
33

44
FROM $BASE_IMAGE
55

6-
ARG LLVM_VER=14.0.6
6+
ARG LLVM_VER=21.1.7
77
ARG RUST_VER=1.90
88
ARG ZIP_VERSION=2501
99
ARG GIT_VERSION=2.51.0

0 commit comments

Comments
 (0)