Skip to content

Commit 6ebe7d2

Browse files
ci/Dockerfile: Always use versioned clang packages
This commit switches to a new strategy to make sure we're installing the most recent LLVM packages. Before this commit, we used the unversioned LLVM packages (e.g., `clang` instead of `clang-18`), which are supposed to provide the latest snapshot, but this is broken for arm64 [1], which we want to add in a later PR. Anyway, the new approach is cleaner because it does not require us to fiddle with the installed `clang` package by removing a symlink. [1] llvm/llvm-project#64790 Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
1 parent 65c79fe commit 6ebe7d2

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

ci/linux-debian.Dockerfile

+16-12
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,21 @@ RUN mkdir gcc && cd gcc && \
4646
cd ../.. && rm -rf gcc && \
4747
ln -s /opt/gcc-snapshot/bin/gcc /usr/bin/gcc-snapshot
4848

49-
# Install clang snapshot
50-
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
49+
# Install clang snapshot, see https://apt.llvm.org/
50+
RUN \
51+
# Setup GPG keys of LLVM repository
52+
apt-get update && apt-get install --no-install-recommends -y wget && \
53+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
5154
# Add repository for this Debian release
5255
. /etc/os-release && echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME} main" >> /etc/apt/sources.list && \
53-
# Install clang snapshot
54-
apt-get update && apt-get install --no-install-recommends -y clang && \
55-
# Remove just the "clang" symlink again
56-
apt-get remove -y clang && \
57-
# We should have exactly two clang versions now
58-
ls /usr/bin/clang* && \
59-
[[ $(ls /usr/bin/clang-?? | sort | wc -l) -eq "2" ]] && \
60-
# Create symlinks for them
61-
ln -s $(ls /usr/bin/clang-?? | sort | tail -1) /usr/bin/clang-snapshot && \
62-
ln -s $(ls /usr/bin/clang-?? | sort | head -1) /usr/bin/clang
56+
apt-get update && \
57+
# Determine the version number of the LLVM development branch
58+
LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort -V | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \
59+
# Install
60+
apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" && \
61+
# Create symlink
62+
ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \
63+
# Clean up
64+
apt-get autoremove -y wget && \
65+
apt-get clean
66+

0 commit comments

Comments
 (0)