From 9b37d80dd84938d87daa480302b4d2cb04798b36 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Wed, 30 Aug 2023 18:11:36 +0200 Subject: [PATCH] ci/Dockerfile: Install MSan runtime dependencies for arm64 binaries This also 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]. Anyway, the new approach is cleaner because it does not require us to fiddle with the installed `clang` package by removing a symlink. [1] https://github.com/llvm/llvm-project/issues/64790 --- ci/linux-debian.Dockerfile | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ci/linux-debian.Dockerfile b/ci/linux-debian.Dockerfile index 48714b42e7..a1a62c641d 100644 --- a/ci/linux-debian.Dockerfile +++ b/ci/linux-debian.Dockerfile @@ -46,17 +46,23 @@ RUN mkdir gcc && cd gcc && \ cd ../.. && rm -rf gcc && \ ln -s /opt/gcc-snapshot/bin/gcc /usr/bin/gcc-snapshot -# Install clang snapshot -RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ +# Install clang snapshot and related packages, see https://apt.llvm.org/ +RUN \ + # Setup GPG keys of LLVM repository + apt-get update && apt-get install --no-install-recommends -y wget && \ + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ # Add repository for this Debian release . /etc/os-release && echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME} main" >> /etc/apt/sources.list && \ - # Install clang snapshot - apt-get update && apt-get install --no-install-recommends -y clang && \ - # Remove just the "clang" symlink again - apt-get remove -y clang && \ - # We should have exactly two clang versions now - ls /usr/bin/clang* && \ - [[ $(ls /usr/bin/clang-?? | sort | wc -l) -eq "2" ]] && \ - # Create symlinks for them - ln -s $(ls /usr/bin/clang-?? | sort | tail -1) /usr/bin/clang-snapshot && \ - ln -s $(ls /usr/bin/clang-?? | sort | head -1) /usr/bin/clang + apt-get update && \ + # Determine the version number of the LLVM development branch + LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \ + # Install packages + apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" "libclang-rt-${LLVM_VERSION}-dev:arm64" && \ + # Assert that we have exactly two clang versions now + ls /usr/bin/clang* && [[ $(ls /usr/bin/clang-?? | sort | wc -l) -eq "2" ]] && \ + # Create symlink for clang-snapshot + ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \ + # Clean up + apt-get autoremove -y wget && \ + apt-get clean +