linux-debian.Dockerfile raw

   1  FROM debian:stable-slim
   2  
   3  SHELL ["/bin/bash", "-c"]
   4  
   5  WORKDIR /root
   6  
   7  # A too high maximum number of file descriptors (with the default value
   8  # inherited from the docker host) can cause issues with some of our tools:
   9  #  - sanitizers hanging: https://github.com/google/sanitizers/issues/1662 
  10  #  - valgrind crashing: https://stackoverflow.com/a/75293014
  11  # This is not be a problem on our CI hosts, but developers who run the image
  12  # on their machines may run into this (e.g., on Arch Linux), so warn them.
  13  # (Note that .bashrc is only executed in interactive bash shells.)
  14  RUN echo 'if [[ $(ulimit -n) -gt 200000 ]]; then echo "WARNING: Very high value reported by \"ulimit -n\". Consider passing \"--ulimit nofile=32768\" to \"docker run\"."; fi' >> /root/.bashrc
  15  
  16  RUN dpkg --add-architecture i386 && \
  17      dpkg --add-architecture s390x && \
  18      dpkg --add-architecture armhf && \
  19      dpkg --add-architecture arm64 && \
  20      dpkg --add-architecture ppc64el
  21  
  22  # dkpg-dev: to make pkg-config work in cross-builds
  23  # llvm: for llvm-symbolizer, which is used by clang's UBSan for symbolized stack traces
  24  RUN apt-get update && apt-get install --no-install-recommends -y \
  25          git ca-certificates \
  26          make automake libtool pkg-config dpkg-dev valgrind qemu-user \
  27          gcc clang llvm libclang-rt-dev libc6-dbg \
  28          g++ \
  29          gcc-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 libubsan1:i386 libasan8:i386 \
  30          gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x \
  31          gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6-dbg:armhf \
  32          gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross libc6-dbg:ppc64el \
  33          gcc-mingw-w64-x86-64-win32 wine64 wine \
  34          gcc-mingw-w64-i686-win32 wine32 \
  35          python3 && \
  36          if ! ( dpkg --print-architecture | grep --quiet "arm64" ) ; then \
  37           apt-get install --no-install-recommends -y \
  38           gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 ;\
  39          fi && \
  40          apt-get clean && rm -rf /var/lib/apt/lists/*
  41  
  42  # Build and install gcc snapshot
  43  ARG GCC_SNAPSHOT_MAJOR=15
  44  RUN apt-get update && apt-get install --no-install-recommends -y wget libgmp-dev libmpfr-dev libmpc-dev flex && \
  45      mkdir gcc && cd gcc && \
  46      wget --progress=dot:giga --https-only --recursive --accept '*.tar.xz' --level 1 --no-directories "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}" && \
  47      wget "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}/sha512.sum" && \
  48      sha512sum --check --ignore-missing sha512.sum && \
  49      # We should have downloaded exactly one tar.xz file
  50      ls && \
  51      [ $(ls *.tar.xz | wc -l) -eq "1" ] && \
  52      tar xf *.tar.xz && \
  53      mkdir gcc-build && cd gcc-build && \
  54      ../*/configure --prefix=/opt/gcc-snapshot --enable-languages=c --disable-bootstrap --disable-multilib --without-isl && \
  55      make -j $(nproc) && \
  56      make install && \
  57      cd ../.. && rm -rf gcc && \
  58      ln -s /opt/gcc-snapshot/bin/gcc /usr/bin/gcc-snapshot && \
  59      apt-get autoremove -y wget libgmp-dev libmpfr-dev libmpc-dev flex && \
  60      apt-get clean && rm -rf /var/lib/apt/lists/*
  61  
  62  # Install clang snapshot, see https://apt.llvm.org/
  63  RUN \
  64      # Setup GPG keys of LLVM repository
  65      apt-get update && apt-get install --no-install-recommends -y wget && \
  66      wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
  67      # Add repository for this Debian release
  68      . /etc/os-release && echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME} main" >> /etc/apt/sources.list && \
  69      apt-get update && \
  70      # Determine the version number of the LLVM development branch
  71      LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort -V | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \
  72      # Install
  73      apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" && \
  74      # Create symlink
  75      ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \
  76      # Clean up
  77      apt-get autoremove -y wget && \
  78      apt-get clean && rm -rf /var/lib/apt/lists/*
  79  
  80