brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.6 KiB · 8a8a6e3 Raw
142 lines · plain
1# ===----------------------------------------------------------------------===##2#3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4# See https://llvm.org/LICENSE.txt for license information.5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6#7# ===----------------------------------------------------------------------===##8#9# This file defines the base image we use for Linux testing using Github Actions.10# From the root of the monorepo, this image can be built with:11#12#   $ docker build --file libcxx/utils/ci/docker/linux-builder-base.dockerfile \13#                  --build-arg GCC_HEAD_VERSION=<version> \14#                  --build-arg LLVM_HEAD_VERSION=<version> .15#16# This image also gets built on every push to `main` that modifies these Docker17# files, and can be found at ghcr.io/libcxx/libcxx-linux-builder-base .18 19FROM docker.io/library/ubuntu:noble20 21# Changing this file causes a rebuild of the image in a GitHub action. However, it does not cause22# the CI runners to switch to that image automatically, that must be done by updating the image used23# by the libc++ self-hosted runners in llvm-zorg. The date uses the ISO format YYYY-MM-DD.24RUN echo "Last forced update executed on 2025-11-11."25 26# Make sure apt-get doesn't try to prompt for stuff like our time zone, etc.27ENV DEBIAN_FRONTEND=noninteractive28 29# populated in the docker-compose file30ARG GCC_HEAD_VERSION31ENV GCC_HEAD_VERSION=${GCC_HEAD_VERSION}32 33# populated in the docker-compose file34ARG LLVM_HEAD_VERSION35ENV LLVM_HEAD_VERSION=${LLVM_HEAD_VERSION}36 37# Install sudo and setup passwordless sudo.38RUN <<EOF39  apt-get update || true40  apt-get install -y sudo || true41  echo "ALL ALL = (ALL) NOPASSWD: ALL" | tee /etc/sudoers || true42EOF43 44# Installing tzdata before other packages avoids the time zone prompts.45# These prompts seem to ignore DEBIAN_FRONTEND=noninteractive.46RUN sudo apt-get update \47    && sudo apt-get install -y \48        tzdata49 50# Install various tools used by the build or the test suite51# TODO add ninja-build once 1.11 is available in Ubuntu, also remove the manual52# installation below.53RUN sudo apt-get update \54    && sudo apt-get install -y \55        bash \56        bzip2 \57        ccache \58        curl \59        gdb \60        git \61        gpg \62        language-pack-en \63        language-pack-fr \64        language-pack-ja \65        language-pack-ru \66        language-pack-zh-hans \67        libedit-dev \68        libncurses5-dev \69        libpython3-dev \70        libxml2-dev \71        lsb-release \72        make \73        ninja-build \74        python3 \75        python3-dev \76        python3-packaging \77        python3-setuptools \78        python3-psutil \79        software-properties-common \80        swig \81        unzip \82        uuid-dev \83        wget \84        xz-utils \85    && sudo rm -rf /var/lib/apt/lists/*86 87# These two locales are not enabled by default so generate them88RUN <<EOF89  set -e90  printf "fr_CA ISO-8859-1\ncs_CZ ISO-8859-2" | sudo tee -a /etc/locale.gen91  sudo mkdir /usr/local/share/i1en/92  printf "fr_CA ISO-8859-1\ncs_CZ ISO-8859-2" | sudo tee -a /usr/local/share/i1en/SUPPORTED93  sudo locale-gen94EOF95 96# Install Clang <latest>, <latest-1> and ToT, which are the ones we support.97# We also install <latest-2> because we need to support the "latest-1" of the98# current LLVM release branch, which is effectively the <latest-2> of the99# tip-of-trunk LLVM. For example, after branching LLVM 14 but before branching100# LLVM 15, we still need to have Clang 12 in this Docker image because the LLVM101# 14 release branch CI uses it. The tip-of-trunk CI will never use Clang 12,102# though.103RUN <<EOF104  set -e105  sudo apt-get update106  wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh107  chmod +x /tmp/llvm.sh108  sudo /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 3)) all  # for CI transitions109  sudo /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 2)) all  # previous release110  sudo /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 1)) all  # latest release111  sudo /tmp/llvm.sh $LLVM_HEAD_VERSION          all  # current ToT112  sudo rm -rf /var/lib/apt/lists/*113EOF114 115# Install the most recent GCC, like clang install the previous version as a transition.116RUN <<EOF117  set -e118  sudo git clone https://github.com/compiler-explorer/infra.git /tmp/ce-infra119  (cd /tmp/ce-infra && sudo make ce)120  # Current ToT, we do not guarantee any support in our support matrix.121  sudo /tmp/ce-infra/bin/ce_install --enable nightly install compilers/c++/nightly/gcc trunk122  sudo ln -s /opt/compiler-explorer/gcc-snapshot/bin/gcc /usr/bin/gcc-$GCC_HEAD_VERSION123  sudo ln -s /opt/compiler-explorer/gcc-snapshot/bin/g++ /usr/bin/g++-$GCC_HEAD_VERSION124  # The latest release.125  sudo /tmp/ce-infra/bin/ce_install install compilers/c++/x86/gcc $((GCC_HEAD_VERSION - 1)).1.0126  sudo ln -s /opt/compiler-explorer/gcc-$((GCC_HEAD_VERSION - 1)).1.0/bin/gcc /usr/bin/gcc-$((GCC_HEAD_VERSION - 1))127  sudo ln -s /opt/compiler-explorer/gcc-$((GCC_HEAD_VERSION - 1)).1.0/bin/g++ /usr/bin/g++-$((GCC_HEAD_VERSION - 1))128  # For CI transitions.129  sudo /tmp/ce-infra/bin/ce_install install compilers/c++/x86/gcc $((GCC_HEAD_VERSION - 2)).1.0130  sudo ln -s /opt/compiler-explorer/gcc-$((GCC_HEAD_VERSION - 2)).1.0/bin/gcc /usr/bin/gcc-$((GCC_HEAD_VERSION - 2))131  sudo ln -s /opt/compiler-explorer/gcc-$((GCC_HEAD_VERSION - 2)).1.0/bin/g++ /usr/bin/g++-$((GCC_HEAD_VERSION - 2))132  sudo rm -rf /tmp/ce-infra133EOF134 135RUN <<EOF136    # Install a recent CMake137    set -e138    wget https://github.com/Kitware/CMake/releases/download/v3.24.4/cmake-3.24.4-linux-x86_64.sh -O /tmp/install-cmake.sh139    sudo bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license140    rm /tmp/install-cmake.sh141EOF142