Skip to content

Commit

Permalink
Prepare msan dockerfile for clang 19
Browse files Browse the repository at this point in the history
  • Loading branch information
RazvanLiviuVarzaru committed Sep 12, 2024
1 parent 70dda2a commit 3296fe6
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions ci_build_images/msan.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,36 @@ ENV GDB_PATH=/msan-libs/bin/gdb
ENV MSAN_LIBDIR=/msan-libs
ENV MSAN_SYMBOLIZER_PATH=/msan-libs/bin/llvm-symbolizer-msan

RUN if [ "${CLANG_VERSION}" -gt 17 ]; then \
export LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind"; \
else \
export LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"; \
fi \
&& echo "LLVM_ENABLE_RUNTIMES=${LLVM_ENABLE_RUNTIMES}" >> /etc/environment

ENV PATH=$MSAN_LIBDIR/bin:$PATH

RUN mkdir $MSAN_LIBDIR \
RUN . /etc/environment \
&& . /etc/os-release \
&& mkdir $MSAN_LIBDIR \
&& mkdir $MSAN_LIBDIR/bin \
&& printf "#!/bin/sh\nunset LD_LIBRARY_PATH\nexec llvm-symbolizer-%s \"\$@\"" "${CLANG_VERSION}" > $MSAN_SYMBOLIZER_PATH \
&& printf '#!/bin/sh\nunset LD_LIBRARY_PATH\nexec /usr/bin/gdb "$@"' > $GDB_PATH \
&& curl -sL https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] \
http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${CLANG_VERSION} main" > /etc/apt/sources.list.d/llvm-toolchain.list \
http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-${CLANG_VERSION} main" > /etc/apt/sources.list.d/llvm-toolchain.list \
&& echo "deb-src [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] \
http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${CLANG_VERSION} main" >> /etc/apt/sources.list.d/llvm-toolchain.list \
http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-${CLANG_VERSION} main" >> /etc/apt/sources.list.d/llvm-toolchain.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends \
clang-${CLANG_VERSION} \
libclang-rt-${CLANG_VERSION}-dev \
libc++abi-${CLANG_VERSION}-dev \
libc++-${CLANG_VERSION}-dev \
llvm-${CLANG_VERSION} \
automake \
&& if [ "${CLANG_VERSION}" = 19 ]; then \
apt-get -y install --no-install-recommends libclang-19-dev libllvmlibc-19-dev; fi \
&& apt-get source libc++-${CLANG_VERSION}-dev \
&& mv llvm-toolchain-${CLANG_VERSION}-${CLANG_VERSION}*/* . \
&& mkdir build \
Expand All @@ -37,7 +49,8 @@ RUN mkdir $MSAN_LIBDIR \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang-${CLANG_VERSION} \
-DCMAKE_CXX_COMPILER=clang++-${CLANG_VERSION} \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-DLLVM_ENABLE_RUNTIMES="${LLVM_ENABLE_RUNTIMES}" \
$(if [ "${CLANG_VERSION}" = 19 ]; then echo "-DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_ENABLE_SPHINX=OFF"; fi) \
-DLLVM_USE_SANITIZER=MemoryWithOrigins \
&& make -C build -j "$(nproc)" \
&& cp -aL build/lib/libc++.so* $MSAN_LIBDIR \
Expand Down Expand Up @@ -86,6 +99,10 @@ RUN apt-get source gnutls28 \
&& apt-get source gmp \
&& mv gmp-*/* . \
&& mk-build-deps -it 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' \
&& if [ "${VERSION_CODENAME}" = "bookworm" ]; then \
sed -e '/^.*"doc\/Makefile".*/d;s/doc\/Makefile //;' -i.bak configure \
&& sed -e 's/^\(SUBDIRS = .*\) doc$/\1/;' -i.bak Makefile.in; \
fi \
&& ./configure \
--disable-assembly \
&& make -j "$(nproc)" \
Expand All @@ -98,6 +115,10 @@ ENV CXXFLAGS="$CFLAGS"
RUN apt-get source cracklib2 \
&& mv cracklib2-*/* . \
&& mk-build-deps -it 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' \
&& if [ "${VERSION_CODENAME}" = "bookworm" ]; then \
aclocal \
&& automake --add-missing \
fi \
&& ./configure \
--with-default-dict=/usr/share/dict/cracklib-small \
&& make -j "$(nproc)" \
Expand Down

0 comments on commit 3296fe6

Please sign in to comment.