util-docker: Cleanup, refactor, better document Dockerfiles (#1292)
* Removes the "docker-compose.yaml" in favor of "docker-bake.hcl". This uses the `docker buildx` tool which has the advantage of enabling multi-platformm builds where desired. By default all images are built targeting `linux/arm64`, `linux/amd64` and `linux/riscv64` as targets with the exception of the GPU images where only `linux/amd64` makes sense. * Remove unused/older Docker build targets (these can easily be re-added but they were not regularly built or have any current usage). * Update "README.md" to better describe these Dockerfiles and how they are built. * Simplify GCC and Clang compiler images. Each uses the Ubuntu 24.04 All Deps image as a base then specialized the compiler on top. * To simply things, all compiler versions are built from 24.04. This means **narrowing the supported versions from GCC v10 to v14 and Clang v14 to v18**. * Fix some bugs in the "docker-bake.hcl" thus ensuring all targets may be built from it. * Cleanup the systemc and sst images: reducing their size and building them off the common 24.04 ubuntu base image.
This commit is contained in:
2
.github/workflows/ci-tests.yaml
vendored
2
.github/workflows/ci-tests.yaml
vendored
@@ -96,7 +96,7 @@ jobs:
|
||||
# for compilation error to be exposed.
|
||||
runs-on: [self-hosted, linux, x64]
|
||||
if: github.event.pull_request.draft == false
|
||||
container: ghcr.io/gem5/clang-version-16:latest
|
||||
container: ghcr.io/gem5/clang-version-18:latest
|
||||
needs: [pre-commit, check-for-change-id]
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
|
||||
7
.github/workflows/compiler-tests.yaml
vendored
7
.github/workflows/compiler-tests.yaml
vendored
@@ -13,9 +13,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: [gcc-version-13, gcc-version-12, gcc-version-11, gcc-version-10, clang-version-16, clang-version-15, clang-version-14, clang-version-13,
|
||||
clang-version-12, clang-version-11, clang-version-10, ubuntu-20.04_all-dependencies, ubuntu-22.04_all-dependencies, ubuntu-24.04_all-dependencies,
|
||||
ubuntu-24.04_min-dependencies]
|
||||
image: [gcc-version-13, gcc-version-12, gcc-version-11, gcc-version-10, clang-version-18, clang-version-17, clang-version-16, clang-version-15,
|
||||
clang-version-14, ubuntu-22.04_all-dependencies, ubuntu-24.04_all-dependencies, ubuntu-24.04_min-dependencies]
|
||||
opts: [.opt, .fast]
|
||||
runs-on: [self-hosted, linux, x64]
|
||||
timeout-minutes: 2880 # 48 hours
|
||||
@@ -33,7 +32,7 @@ jobs:
|
||||
matrix:
|
||||
gem5-compilation: [ARM, ARM_MESI_Three_Level, ARM_MESI_Three_Level_HTM, ARM_MOESI_hammer, Garnet_standalone, MIPS, 'NULL', NULL_MESI_Two_Level,
|
||||
NULL_MOESI_CMP_directory, NULL_MOESI_CMP_token, NULL_MOESI_hammer, POWER, RISCV, SPARC, X86, X86_MI_example, X86_MOESI_AMD_Base, VEGA_X86]
|
||||
image: [gcc-version-13, clang-version-16]
|
||||
image: [gcc-version-13, clang-version-18]
|
||||
opts: [.opt]
|
||||
runs-on: [self-hosted, linux, x64]
|
||||
timeout-minutes: 2880 # 48 hours
|
||||
|
||||
@@ -1,3 +1,75 @@
|
||||
This directory contains Dockerfiles used to create images used in the gem5 project.
|
||||
The `docker-compose.yaml` defines the building of each image.
|
||||
The images can be built locally using `docker-compose build`.
|
||||
# The gem5 Dockerfiles
|
||||
|
||||
This directory contains the Dockerfiles used to build the gem5 Docker images.
|
||||
The Docker images are used to run gem5 in a containerized environment.
|
||||
|
||||
## The Docker Registry
|
||||
|
||||
We use the Github Container Registry to host the gem5 Docker images. The images are available at the [ghcr.io/gem5] URI.
|
||||
|
||||
### Pulling the Docker Images
|
||||
|
||||
You can pull the gem5 Docker images using the following command:
|
||||
|
||||
```sh
|
||||
# Example: Pulling the gem5 Ubuntu 24.04 image.
|
||||
docker pull ghcr.io/gem5/gem5/ubuntu-24.04_all-dependencies:latest
|
||||
```
|
||||
|
||||
## Building the Docker Images
|
||||
|
||||
The gem5 Dockerfiles are available in this directory.
|
||||
All the currently supported Docker images, stored in the registery, are built using these Dockerfiles.
|
||||
|
||||
### Docker buildx
|
||||
|
||||
The Dockerfiles are built using the Docker buildx feature. The buildx feature is used to build multi-architecture images. The buildx feature is available in Docker 19.03 and later versions.
|
||||
|
||||
For more information on the Docker buildx feature, refer to the [Docker documentation](https://docs.docker.com/buildx/working-with-buildx/).
|
||||
|
||||
In this setup we store the buildx configurations in the "docker-bake.hcl" file.
|
||||
It is worth consulting these files and noting the "targets" and "groups", these can be passed to the buildx command to build that target image or group of images.
|
||||
|
||||
For example, the following will build the "ubuntu-24.04_all-dependencies" image:
|
||||
|
||||
```sh
|
||||
docker buildx bake ubuntu-24.04_all-dependencies
|
||||
```
|
||||
|
||||
And the following will build all the gcc-compiler images:
|
||||
|
||||
```sh
|
||||
docker buildx bake gcc-compiler
|
||||
```
|
||||
|
||||
If no target is specified all the images will be built.
|
||||
|
||||
```sh
|
||||
docker buildx bake
|
||||
```
|
||||
|
||||
## Pushing the Docker Images
|
||||
|
||||
To push the Docker images to the Github Container Registry, you can use the following command:
|
||||
|
||||
```sh
|
||||
docker buildx bake <target/group> --push
|
||||
```
|
||||
|
||||
However, you need to authenticate with the Github Container Registry, creating a token with write access to the gem5 GitHub Docker registry.
|
||||
|
||||
### Authenticating with the Github Container Registry
|
||||
|
||||
To push images, you need to authenticate with the Github Container Registry. You can authenticate using a Github Personal Access Token (PAT). The PAT can be generated from the Github settings. The PAT should have the `write:packages` scope to read the Github Container registry images.
|
||||
|
||||
When you have the PAT, you can authenticate using the following command:
|
||||
|
||||
```sh
|
||||
echo $GITHUB_PAT | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin
|
||||
```
|
||||
|
||||
## gem5 Docker Tags
|
||||
|
||||
As is standard with Docker images, latest image created for each Dockerfile is tagged as `latest`.
|
||||
|
||||
When a new major release of gem5 is created the Docker images compatible with that release are tagged with the gem5 version. For example, the images compatible with gem5 v23.1.0.0 are tagged as `v23-0`: `ghcr.io/gem5/gem5/ubuntu-24.04_all-dependencies:v23-0`.
|
||||
|
||||
14
util/dockerfiles/clang-compiler/Dockerfile
Normal file
14
util/dockerfiles/clang-compiler/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM --platform=${BUILDPLATFORM} ghcr.io/gem5/ubuntu-24.04_all-dependencies:latest
|
||||
|
||||
ARG version=16 # Version of Clang to install in this image. Default is 16.
|
||||
|
||||
RUN apt -y update && \
|
||||
apt -y install clang-${version} && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/clang++ clang++ /usr/bin/clang++-${version} 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-${version} 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/clang++-${version} 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/clang-${version} 100
|
||||
@@ -40,7 +40,8 @@
|
||||
# there is a pre-built gem5 binary in each devcontainer. This can save time
|
||||
# if the container is used for education or demonstration purposes.
|
||||
FROM ghcr.io/gem5/ubuntu-24.04_all-dependencies:latest as builder
|
||||
RUN git clone --branch v24.0 https://github.com/gem5/gem5
|
||||
RUN wget https://github.com/gem5/gem5/archive/refs/tags/v24.0.tar.gz && \
|
||||
tar xzf v24.0.tar.gz && mv gem5-24.0 gem5 && rm v24.0.tar.gz
|
||||
WORKDIR /gem5
|
||||
RUN scons build/ALL/gem5.opt -j`nproc`
|
||||
RUN scons defconfig build/ALL_CHI build_opts/ALL && \
|
||||
|
||||
@@ -32,7 +32,15 @@ variable "IMAGE_URI" {
|
||||
}
|
||||
|
||||
variable "TAG" {
|
||||
default = "bootcamp-2024"
|
||||
default = "latest"
|
||||
}
|
||||
|
||||
# Common attributes across all targets. Note: these can be overwritten.
|
||||
target "common" {
|
||||
# Here we are enabling multi-platform builds. We are compiling to ARM, X86,
|
||||
# and RISC-V.
|
||||
platforms = ["linux/amd64", "linux/arm64", "linux/riscv64"]
|
||||
pull = true
|
||||
}
|
||||
|
||||
# A group of targets to be built. Note: groups can contain other groups.
|
||||
@@ -40,54 +48,133 @@ variable "TAG" {
|
||||
# `docker buildx bake --push ubuntu-20-04_all-dependencies` or
|
||||
# `docker buildx bake --push ubuntu-releases`.
|
||||
group "default" {
|
||||
targets=["clang-compilers", "ubuntu-releases", "gcc-compilers", "gcn-gpu", "gpu-fs", "sst", "systemc", "llvm-gnu-cross-compiler-riscv64", "gem5-all-min-dependencies"]
|
||||
}
|
||||
|
||||
group "ubuntu-releases" {
|
||||
targets=["ubuntu-24-04_all-dependencies", "ubuntu-22-04_all-dependencies", "ubuntu-20-04_all-dependencies", "ubuntu-24-04_min-dependencies"]
|
||||
targets=[
|
||||
"clang-compilers",
|
||||
"gcc-compilers",
|
||||
"ubuntu-releases",
|
||||
"gcn-gpu",
|
||||
"gpu-fs",
|
||||
"sst",
|
||||
"systemc",
|
||||
"devcontainer"
|
||||
]
|
||||
}
|
||||
|
||||
group "clang-compilers" {
|
||||
targets = ["clang-compilers-base-20-04", "clang-compilers-base-22-04", "clang-compilers-16"]
|
||||
targets = [
|
||||
"clang-version-14",
|
||||
"clang-version-15",
|
||||
"clang-version-16",
|
||||
"clang-version-17",
|
||||
"clang-version-18"
|
||||
]
|
||||
}
|
||||
|
||||
target "clang-version-14" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
args = {
|
||||
version = "14"
|
||||
}
|
||||
context = "clang-compiler"
|
||||
tags = ["${IMAGE_URI}/clang-version-14:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-version-15" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
args = {
|
||||
version = "15"
|
||||
}
|
||||
context = "clang-compiler"
|
||||
tags = ["${IMAGE_URI}/clang-version-15:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-version-16" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
args = {
|
||||
version = "16"
|
||||
}
|
||||
context = "clang-compiler"
|
||||
tags = ["${IMAGE_URI}/clang-version-16:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-version-17" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
args = {
|
||||
version = "17"
|
||||
}
|
||||
context = "clang-compiler"
|
||||
tags = ["${IMAGE_URI}/clang-version-17:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-version-18" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
args = {
|
||||
version = "18"
|
||||
}
|
||||
context = "clang-compiler"
|
||||
tags = ["${IMAGE_URI}/clang-version-18:${TAG}"]
|
||||
}
|
||||
|
||||
group "gcc-compilers" {
|
||||
targets = ["gcc-compilers-base-20-04", "gcc-compilers-base-22-04"]
|
||||
targets = [
|
||||
"gcc-version-10",
|
||||
"gcc-version-11",
|
||||
"gcc-version-12",
|
||||
"gcc-version-13"
|
||||
]
|
||||
}
|
||||
|
||||
# Common attributes across all targets. Note: these can be overwritten.
|
||||
target "common" {
|
||||
# Here we are enabling multi-platform builds. We are compiling to both ARM
|
||||
# amd X86.
|
||||
platforms = ["linux/amd64", "linux/arm64", "linux/riscv64"]
|
||||
}
|
||||
|
||||
target "gcn-gpu" {
|
||||
target "gcc-version-10" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "gcn-gpu"
|
||||
tags = ["${IMAGE_URI}/gcn-gpu:${TAG}"]
|
||||
args = {
|
||||
version = "10"
|
||||
}
|
||||
context = "gcc-compiler"
|
||||
tags = ["${IMAGE_URI}/gcc-version-10:${TAG}"]
|
||||
}
|
||||
|
||||
target "gpu-fs" {
|
||||
target "gcc-version-11" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "gpu-fs"
|
||||
tags = ["${IMAGE_URI}/gpu-fs:${TAG}"]
|
||||
args = {
|
||||
version = "11"
|
||||
}
|
||||
context = "gcc-compiler"
|
||||
tags = ["${IMAGE_URI}/gcc-version-11:${TAG}"]
|
||||
}
|
||||
|
||||
target "sst" {
|
||||
target "gcc-version-12" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "sst-11.1.0"
|
||||
tags = ["${IMAGE_URI}/sst-env:${TAG}"]
|
||||
args = {
|
||||
version = "12"
|
||||
}
|
||||
context = "gcc-compiler"
|
||||
tags = ["${IMAGE_URI}/gcc-version-12:${TAG}"]
|
||||
}
|
||||
|
||||
target "systemc" {
|
||||
target "gcc-version-13" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "systemc-2.3.3"
|
||||
tags = ["${IMAGE_URI}/systemc-env:${TAG}"]
|
||||
args = {
|
||||
version = "13"
|
||||
}
|
||||
context = "gcc-compiler"
|
||||
tags = ["${IMAGE_URI}/gcc-version-13:${TAG}"]
|
||||
}
|
||||
|
||||
group "ubuntu-releases" {
|
||||
targets=[
|
||||
"ubuntu-24-04_all-dependencies",
|
||||
"ubuntu-22-04_all-dependencies",
|
||||
"ubuntu-24-04_min-dependencies"
|
||||
]
|
||||
}
|
||||
|
||||
target "ubuntu-24-04_all-dependencies" {
|
||||
@@ -104,21 +191,6 @@ target "ubuntu-22-04_all-dependencies" {
|
||||
tags = ["${IMAGE_URI}/ubuntu-22.04_all-dependencies:${TAG}"]
|
||||
}
|
||||
|
||||
target "devcontainer" {
|
||||
inherits = ["common"]
|
||||
dependencies = ["devcontainer"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "devcontainer"
|
||||
tags = ["${IMAGE_URI}/devcontainer:${TAG}"]
|
||||
}
|
||||
|
||||
target "ubuntu-20-04_all-dependencies" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "ubuntu-20.04_all-dependencies"
|
||||
tags = ["${IMAGE_URI}/ubuntu-20.04_all-dependencies:${TAG}"]
|
||||
}
|
||||
|
||||
target "ubuntu-24-04_min-dependencies" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
@@ -126,79 +198,40 @@ target "ubuntu-24-04_min-dependencies" {
|
||||
tags = ["${IMAGE_URI}/ubuntu-24.04_min-dependencies:${TAG}"]
|
||||
}
|
||||
|
||||
target "gcc-compilers-base-20-04" {
|
||||
name = "gcc-compilers-${replace(ver, ".", "-")}"
|
||||
target "gcn-gpu" {
|
||||
inherits = ["common"]
|
||||
context = "ubuntu-20.04_gcc-version"
|
||||
platform = "linux/amd64" # Only build for x86.
|
||||
dockerfile = "Dockerfile"
|
||||
matrix = {
|
||||
ver = ["8", "9", "10"]
|
||||
}
|
||||
args = {
|
||||
version = ver
|
||||
}
|
||||
tags = ["${IMAGE_URI}/gcc-version-${ver}:${TAG}"]
|
||||
context = "gcn-gpu"
|
||||
tags = ["${IMAGE_URI}/gcn-gpu:${TAG}"]
|
||||
}
|
||||
|
||||
target "gcc-compilers-base-22-04" {
|
||||
name = "gcc-compilers-${replace(ver, ".", "-")}"
|
||||
target "gpu-fs" {
|
||||
inherits = ["common"]
|
||||
context = "ubuntu-22.04_gcc-version"
|
||||
platform = "linux/amd64" # Only build for x86.
|
||||
dockerfile = "Dockerfile"
|
||||
matrix = {
|
||||
ver = ["11", "12"]
|
||||
}
|
||||
args = {
|
||||
version = ver
|
||||
}
|
||||
tags = ["${IMAGE_URI}/gcc-version-${ver}:${TAG}"]
|
||||
context = "gpu-fs"
|
||||
tags = ["${IMAGE_URI}/gpu-fs:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-compilers-base-20-04" {
|
||||
name = "clang-compilers-${replace(ver, ".", "-")}"
|
||||
target "sst" {
|
||||
inherits = ["common"]
|
||||
context = "ubuntu-20.04_clang-version"
|
||||
dockerfile = "Dockerfile"
|
||||
matrix = {
|
||||
ver = ["10", "11", "12"]
|
||||
}
|
||||
args = {
|
||||
version = ver
|
||||
}
|
||||
tags = ["${IMAGE_URI}/clang-version-${ver}:${TAG}"]
|
||||
context = "sst"
|
||||
tags = ["${IMAGE_URI}/sst-env:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-compilers-base-22-04" {
|
||||
name = "clang-compilers-${replace(ver, ".", "-")}"
|
||||
target "systemc" {
|
||||
inherits = ["common"]
|
||||
context = "ubuntu-22.04_clang-version"
|
||||
dockerfile = "Dockerfile"
|
||||
matrix = {
|
||||
ver = ["13", "14", "15"]
|
||||
}
|
||||
args = {
|
||||
version = ver
|
||||
}
|
||||
tags = ["${IMAGE_URI}/clang-version-${ver}:${TAG}"]
|
||||
context = "systemc"
|
||||
tags = ["${IMAGE_URI}/systemc-env:${TAG}"]
|
||||
}
|
||||
|
||||
target "clang-compilers-16" {
|
||||
target "devcontainer" {
|
||||
inherits = ["common"]
|
||||
dependencies = ["devcontainer"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "ubuntu-22.04_clang_16"
|
||||
tags = ["${IMAGE_URI}/clang-version-16:${TAG}"]
|
||||
}
|
||||
|
||||
target "llvm-gnu-cross-compiler-riscv64" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "llvm-gnu-cross-compiler-riscv64"
|
||||
tags = ["${IMAGE_URI}/llvm-gnu-cross-compiler-riscv64:${TAG}"]
|
||||
}
|
||||
|
||||
target "gem5-all-min-dependencies" {
|
||||
inherits = ["common"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "gem5-all-min-dependencies"
|
||||
tags = ["${IMAGE_URI}/gem5-all-min-dependencies:${TAG}"]
|
||||
context = "devcontainer"
|
||||
tags = ["${IMAGE_URI}/devcontainer:${TAG}"]
|
||||
}
|
||||
|
||||
14
util/dockerfiles/gcc-compiler/Dockerfile
Normal file
14
util/dockerfiles/gcc-compiler/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM --platform=${BUILDPLATFORM} ghcr.io/gem5/ubuntu-24.04_all-dependencies:latest
|
||||
|
||||
ARG version=13 # Version of GCC to install in this image. Default is 13.
|
||||
|
||||
RUN apt -y update && \
|
||||
apt -y install gcc-${version} g++-${version} && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++-${version} 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-${version} 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-${version} 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/gcc-${version} 100
|
||||
@@ -1,72 +0,0 @@
|
||||
# Copyright (c) 2022 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
# stage 1: download the dependencies
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:20.04 AS stage1
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && apt -y install \
|
||||
binutils build-essential libtool texinfo gzip zip unzip patchutils curl git \
|
||||
make cmake ninja-build automake bison flex gperf grep sed gawk bc \
|
||||
zlib1g-dev libexpat1-dev libmpc-dev libglib2.0-dev libfdt-dev libpixman-1-dev
|
||||
|
||||
# stage 2: download the compilers and compile them
|
||||
FROM stage1 AS stage2
|
||||
RUN mkdir -p /riscv/_install
|
||||
WORKDIR /riscv
|
||||
ENV PATH=`/riscv/_install/bin:$PATH`
|
||||
RUN git clone https://github.com/riscv/riscv-gnu-toolchain
|
||||
WORKDIR /riscv/riscv-gnu-toolchain
|
||||
RUN git checkout 051b9f7ddb7d136777505ea19c70a41926842b96
|
||||
RUN git submodule update --init --recursive
|
||||
RUN ./configure --prefix=/riscv/_install --enable-multilib
|
||||
RUN make linux -j`nproc`
|
||||
RUN make install
|
||||
|
||||
WORKDIR /riscv
|
||||
RUN git clone https://github.com/llvm/llvm-project.git riscv-llvm
|
||||
WORKDIR /riscv/riscv-llvm
|
||||
RUN git checkout 2ef95efb414e215490a222de05cafdffb8054758
|
||||
RUN ln -s ../../clang llvm/tools || true
|
||||
RUN mkdir _build
|
||||
WORKDIR /riscv/riscv-llvm/_build
|
||||
RUN cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" \
|
||||
-DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True \
|
||||
-DCMAKE_INSTALL_PREFIX="/riscv/_install" \
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False \
|
||||
-DDEFAULT_SYSROOT="/riscv/_install/sysroot" \
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" \
|
||||
-DLLVM_TARGETS_TO_BUILD="RISCV" \
|
||||
../llvm
|
||||
RUN cmake --build . --target install -j`nproc`
|
||||
|
||||
# stage 3: create a new container with the compiled cross-compilers only
|
||||
FROM stage1
|
||||
|
||||
RUN mkdir -p /riscv/
|
||||
COPY --from=stage2 /riscv/_install/ /riscv/_install
|
||||
ENV PATH=/riscv/_install/bin:$PATH
|
||||
@@ -24,27 +24,22 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:20.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install build-essential git m4 scons zlib1g zlib1g-dev \
|
||||
libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \
|
||||
python3-dev python-is-python3 doxygen libboost-all-dev \
|
||||
libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config pip \
|
||||
python3-venv wget
|
||||
FROM --platform=${BUILDPLATFORM} ghcr.io/gem5/ubuntu-24.04_all-dependencies:latest
|
||||
|
||||
# Setting the environmental variables
|
||||
ENV PATH=$PATH:$SST_CORE_HOME/bin
|
||||
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$SST_CORE_HOME/lib/pkgconfig/
|
||||
ENV SST_CORE_HOME="/sst/"
|
||||
|
||||
# Use GCC 10
|
||||
RUN apt update && apt -y install gcc-10 g++-10
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++-10 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-10 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-10 100
|
||||
RUN update-alternatives --install \
|
||||
RUN apt -y update && apt -y install gcc-10 g++-10 &&\
|
||||
update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++-10 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-10 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-10 100 && \
|
||||
update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/gcc-10 100
|
||||
|
||||
# SST Stuff
|
||||
@@ -52,24 +47,26 @@ RUN mkdir /sst
|
||||
|
||||
# Download and build SST-Core without MPI support
|
||||
WORKDIR /sst/
|
||||
RUN wget https://github.com/sstsimulator/sst-core/releases/download/v13.0.0_Final/sstcore-13.0.0.tar.gz; \
|
||||
tar xf sstcore-13.0.0.tar.gz;
|
||||
WORKDIR /sst/sstcore-13.0.0/
|
||||
RUN ./configure --prefix=$SST_CORE_HOME --with-python=/usr/bin/python3-config \
|
||||
--disable-mpi; \
|
||||
make all -j $(nproc); \
|
||||
make install;
|
||||
RUN wget https://github.com/sstsimulator/sst-core/releases/download/v13.0.0_Final/sstcore-13.0.0.tar.gz && \
|
||||
tar xf sstcore-13.0.0.tar.gz && \
|
||||
cd sstcore-13.0.0/ && \
|
||||
./configure --prefix=$SST_CORE_HOME --with-python=/usr/bin/python3-config \
|
||||
--disable-mpi && \
|
||||
make all -j $(nproc) && \
|
||||
make install && \
|
||||
cd /sst && rm -rf sstcore-13.0.0.tar.gz sstcore-13.0.0
|
||||
|
||||
# Download and build SST-Elements
|
||||
WORKDIR /sst
|
||||
RUN wget https://github.com/sstsimulator/sst-elements/releases/download/v13.0.0_Final/sstelements-13.0.0.tar.gz; \
|
||||
tar xf sstelements-13.0.0.tar.gz;
|
||||
WORKDIR /sst/sst-elements-library-13.0.0/
|
||||
RUN ./configure --prefix=$SST_CORE_HOME --with-python=/usr/bin/python3-config \
|
||||
--with-sst-core=$SST_CORE_HOME; \
|
||||
make all -j $(nproc); \
|
||||
make install;
|
||||
RUN wget https://github.com/sstsimulator/sst-elements/releases/download/v13.0.0_Final/sstelements-13.0.0.tar.gz && \
|
||||
tar xf sstelements-13.0.0.tar.gz && \
|
||||
cd sst-elements-library-13.0.0 && \
|
||||
./configure --prefix=$SST_CORE_HOME --with-python=/usr/bin/python3-config \
|
||||
--with-sst-core=$SST_CORE_HOME && \
|
||||
make all -j $(nproc) && \
|
||||
make install && \
|
||||
cd /sst && rm -rf sstelements-13.0.0.tar.gz sst-elements-library-13.0.0
|
||||
|
||||
# Setting the environmental variables
|
||||
#Setting the environmental variables
|
||||
ENV PATH=$PATH:$SST_CORE_HOME/bin
|
||||
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$SST_CORE_HOME/lib/pkgconfig/
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# Copyright (c) 2021 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install build-essential git m4 scons zlib1g zlib1g-dev \
|
||||
libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \
|
||||
python3-dev python-is-python3 doxygen libboost-all-dev \
|
||||
libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config pip \
|
||||
python3-venv wget
|
||||
|
||||
RUN mkdir /systemc
|
||||
WORKDIR /systemc
|
||||
RUN wget https://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.3.tar.gz; \
|
||||
tar xf systemc-2.3.3.tar.gz
|
||||
|
||||
WORKDIR /systemc/systemc-2.3.3
|
||||
RUN mkdir objdir
|
||||
WORKDIR objdir
|
||||
ENV CXX="g++"
|
||||
ENV CXXFLAGS="-std=c++17"
|
||||
|
||||
RUN ../configure --prefix=/opt/systemc
|
||||
RUN make -j8 && make install
|
||||
RUN make clean
|
||||
|
||||
WORKDIR /
|
||||
RUN rm -rf /systemc/systemc-2.3.3/objdir
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2022 The Regents of the University of California
|
||||
# Copyright (c) 2021 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -24,13 +24,19 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} ghcr.io/gem5/ubuntu-22.04_min-dependencies:latest as source
|
||||
RUN apt -y update && apt -y install git
|
||||
RUN git clone -b develop https://github.com/gem5/gem5/ /gem5
|
||||
WORKDIR /gem5
|
||||
RUN scons -j`nproc` build/ALL/gem5.fast
|
||||
FROM --platform=${BUILDPLATFORM} ghcr.io/gem5/ubuntu-24.04_all-dependencies:latest
|
||||
|
||||
FROM ghcr.io/gem5/ubuntu-22.04_min-dependencies:latest
|
||||
COPY --from=source /gem5/build/ALL/gem5.fast /usr/local/bin/gem5
|
||||
ENV CXX="g++"
|
||||
ENV CXXFLAGS="-std=c++17"
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/gem5" ]
|
||||
RUN wget https://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.3.tar.gz; \
|
||||
tar xf systemc-2.3.3.tar.gz && \
|
||||
rm systemc-2.3.3.tar.gz && \
|
||||
cd systemc-2.3.3 && \
|
||||
mkdir objdir && \
|
||||
cd objdir && \
|
||||
../configure --prefix=/opt/systemc && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd ../.. && \
|
||||
rm -rf systemc-2.3.3
|
||||
@@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2020 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:20.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install build-essential git m4 scons zlib1g zlib1g-dev \
|
||||
libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \
|
||||
python3-dev python-is-python3 doxygen libboost-all-dev \
|
||||
libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config pip \
|
||||
python3-venv black gcc-10 g++-10 cmake python3-tk wget libssl-dev
|
||||
|
||||
RUN pip install mypy pre-commit
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++-10 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-10 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-10 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/gcc-10 100
|
||||
|
||||
|
||||
# DRAMSys requires cmake >= 3.24.0.
|
||||
RUN wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0.tar.gz \
|
||||
&& tar -xzf cmake-3.24.0.tar.gz \
|
||||
&& cd cmake-3.24.0 \
|
||||
&& ./bootstrap \
|
||||
&& make -j`nproc` \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
&& rm -rf cmake-3.24.0.tar.gz cmake-3.24.0
|
||||
@@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2021 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:20.04
|
||||
|
||||
# Valid version values:
|
||||
# 6.0
|
||||
# 7
|
||||
# 8
|
||||
# 9
|
||||
# 10
|
||||
# 11
|
||||
# 12
|
||||
ARG version
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
|
||||
protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
|
||||
python-is-python3 doxygen libboost-all-dev libhdf5-serial-dev \
|
||||
python3-pydot libpng-dev clang-${version} make \
|
||||
# This is needed as clang-8 does not have the libstdc++-10-dev package.
|
||||
# It is necessary for compilation.
|
||||
libstdc++-10-dev
|
||||
|
||||
RUN apt-get --purge -y remove gcc
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/clang++ clang++ /usr/bin/clang++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/clang++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/clang-${version} 100
|
||||
@@ -1,49 +0,0 @@
|
||||
# Copyright (c) 2020 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:20.04
|
||||
|
||||
# Valid version values:
|
||||
# 7
|
||||
# 8
|
||||
# 9 # Not supported. See: https://github.com/gem5/gem5/issues/555.
|
||||
# 10
|
||||
ARG version
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
|
||||
protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
|
||||
python-is-python3 doxygen libboost-all-dev libhdf5-serial-dev \
|
||||
python3-pydot libpng-dev gcc-${version} g++-${version} make
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/gcc-${version} 100
|
||||
@@ -1,49 +0,0 @@
|
||||
# Copyright (c) 2023 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:22.04
|
||||
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
|
||||
protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
|
||||
python-is-python3 doxygen libboost-all-dev libhdf5-serial-dev \
|
||||
python3-pydot libpng-dev make lsb-release wget \
|
||||
software-properties-common gnupg
|
||||
|
||||
COPY llvm.sh /llvm.sh
|
||||
RUN ./llvm.sh 16
|
||||
|
||||
RUN apt-get --purge -y remove gcc
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/clang++ clang++ /usr/bin/clang++-16 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-16 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/clang++-16 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/clang-16 100
|
||||
@@ -1,176 +0,0 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
################################################################################
|
||||
#
|
||||
# This script will install the llvm toolchain on the different
|
||||
# Debian and Ubuntu versions
|
||||
|
||||
set -eux
|
||||
|
||||
usage() {
|
||||
set +x
|
||||
echo "Usage: $0 [llvm_major_version] [all] [OPTIONS]" 1>&2
|
||||
echo -e "all\t\t\tInstall all packages." 1>&2
|
||||
echo -e "-n=code_name\t\tSpecifies the distro codename, for example bionic" 1>&2
|
||||
echo -e "-h\t\t\tPrints this help." 1>&2
|
||||
echo -e "-m=repo_base_url\tSpecifies the base URL from which to download." 1>&2
|
||||
exit 1;
|
||||
}
|
||||
|
||||
CURRENT_LLVM_STABLE=17
|
||||
BASE_URL="http://apt.llvm.org"
|
||||
|
||||
# Check for required tools
|
||||
needed_binaries=(lsb_release wget add-apt-repository gpg)
|
||||
missing_binaries=()
|
||||
for binary in "${needed_binaries[@]}"; do
|
||||
if ! which $binary &>/dev/null ; then
|
||||
missing_binaries+=($binary)
|
||||
fi
|
||||
done
|
||||
if [[ ${#missing_binaries[@]} -gt 0 ]] ; then
|
||||
echo "You are missing some tools this script requires: ${missing_binaries[@]}"
|
||||
echo "(hint: apt install lsb-release wget software-properties-common gnupg)"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# Set default values for commandline arguments
|
||||
# We default to the current stable branch of LLVM
|
||||
LLVM_VERSION=$CURRENT_LLVM_STABLE
|
||||
ALL=0
|
||||
DISTRO=$(lsb_release -is)
|
||||
VERSION=$(lsb_release -sr)
|
||||
UBUNTU_CODENAME=""
|
||||
CODENAME_FROM_ARGUMENTS=""
|
||||
# Obtain VERSION_CODENAME and UBUNTU_CODENAME (for Ubuntu and its derivatives)
|
||||
source /etc/os-release
|
||||
DISTRO=${DISTRO,,}
|
||||
case ${DISTRO} in
|
||||
debian)
|
||||
# Debian Trixie has a workaround because of
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038383
|
||||
if [[ "${VERSION}" == "unstable" ]] || [[ "${VERSION}" == "testing" ]] || [[ "${VERSION_CODENAME}" == "trixie" ]]; then
|
||||
CODENAME=unstable
|
||||
LINKNAME=
|
||||
else
|
||||
# "stable" Debian release
|
||||
CODENAME=${VERSION_CODENAME}
|
||||
LINKNAME=-${CODENAME}
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# ubuntu and its derivatives
|
||||
if [[ -n "${UBUNTU_CODENAME}" ]]; then
|
||||
CODENAME=${UBUNTU_CODENAME}
|
||||
if [[ -n "${CODENAME}" ]]; then
|
||||
LINKNAME=-${CODENAME}
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# read optional command line arguments
|
||||
if [ "$#" -ge 1 ] && [ "${1::1}" != "-" ]; then
|
||||
if [ "$1" != "all" ]; then
|
||||
LLVM_VERSION=$1
|
||||
else
|
||||
# special case for ./llvm.sh all
|
||||
ALL=1
|
||||
fi
|
||||
OPTIND=2
|
||||
if [ "$#" -ge 2 ]; then
|
||||
if [ "$2" == "all" ]; then
|
||||
# Install all packages
|
||||
ALL=1
|
||||
OPTIND=3
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
while getopts ":hm:n:" arg; do
|
||||
case $arg in
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
m)
|
||||
BASE_URL=${OPTARG}
|
||||
;;
|
||||
n)
|
||||
CODENAME=${OPTARG}
|
||||
if [[ "${CODENAME}" == "unstable" ]]; then
|
||||
# link name does not apply to unstable repository
|
||||
LINKNAME=
|
||||
else
|
||||
LINKNAME=-${CODENAME}
|
||||
fi
|
||||
CODENAME_FROM_ARGUMENTS="true"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A LLVM_VERSION_PATTERNS
|
||||
LLVM_VERSION_PATTERNS[9]="-9"
|
||||
LLVM_VERSION_PATTERNS[10]="-10"
|
||||
LLVM_VERSION_PATTERNS[11]="-11"
|
||||
LLVM_VERSION_PATTERNS[12]="-12"
|
||||
LLVM_VERSION_PATTERNS[13]="-13"
|
||||
LLVM_VERSION_PATTERNS[14]="-14"
|
||||
LLVM_VERSION_PATTERNS[15]="-15"
|
||||
LLVM_VERSION_PATTERNS[16]="-16"
|
||||
LLVM_VERSION_PATTERNS[17]="-17"
|
||||
LLVM_VERSION_PATTERNS[18]=""
|
||||
|
||||
if [ ! ${LLVM_VERSION_PATTERNS[$LLVM_VERSION]+_} ]; then
|
||||
echo "This script does not support LLVM version $LLVM_VERSION"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
LLVM_VERSION_STRING=${LLVM_VERSION_PATTERNS[$LLVM_VERSION]}
|
||||
|
||||
# join the repository name
|
||||
if [[ -n "${CODENAME}" ]]; then
|
||||
REPO_NAME="deb ${BASE_URL}/${CODENAME}/ llvm-toolchain${LINKNAME}${LLVM_VERSION_STRING} main"
|
||||
|
||||
# check if the repository exists for the distro and version
|
||||
if ! wget -q --method=HEAD ${BASE_URL}/${CODENAME} &> /dev/null; then
|
||||
if [[ -n "${CODENAME_FROM_ARGUMENTS}" ]]; then
|
||||
echo "Specified codename '${CODENAME}' is not supported by this script."
|
||||
else
|
||||
echo "Distribution '${DISTRO}' in version '${VERSION}' is not supported by this script."
|
||||
fi
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# install everything
|
||||
|
||||
if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then
|
||||
# download GPG key once
|
||||
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
|
||||
fi
|
||||
|
||||
if [[ -z "`apt-key list 2> /dev/null | grep -i llvm`" ]]; then
|
||||
# Delete the key in the old format
|
||||
apt-key del AF4F7421
|
||||
fi
|
||||
add-apt-repository "${REPO_NAME}"
|
||||
apt-get update
|
||||
PKG="clang-$LLVM_VERSION lldb-$LLVM_VERSION lld-$LLVM_VERSION clangd-$LLVM_VERSION"
|
||||
if [[ $ALL -eq 1 ]]; then
|
||||
# same as in test-install.sh
|
||||
# No worries if we have dups
|
||||
PKG="$PKG clang-tidy-$LLVM_VERSION clang-format-$LLVM_VERSION clang-tools-$LLVM_VERSION llvm-$LLVM_VERSION-dev lld-$LLVM_VERSION lldb-$LLVM_VERSION llvm-$LLVM_VERSION-tools libomp-$LLVM_VERSION-dev libc++-$LLVM_VERSION-dev libc++abi-$LLVM_VERSION-dev libclang-common-$LLVM_VERSION-dev libclang-$LLVM_VERSION-dev libclang-cpp$LLVM_VERSION-dev libunwind-$LLVM_VERSION-dev"
|
||||
if test $LLVM_VERSION -gt 14; then
|
||||
PKG="$PKG libclang-rt-$LLVM_VERSION-dev libpolly-$LLVM_VERSION-dev"
|
||||
fi
|
||||
fi
|
||||
apt-get install -y $PKG
|
||||
@@ -1,49 +0,0 @@
|
||||
# Copyright (c) 2022 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:22.04
|
||||
|
||||
# Valid version values:
|
||||
# 13
|
||||
# 15
|
||||
ARG version
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
|
||||
protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
|
||||
python-is-python3 doxygen libboost-all-dev libhdf5-serial-dev \
|
||||
python3-pydot libpng-dev clang-${version} make
|
||||
|
||||
RUN apt-get --purge -y remove gcc
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/clang++ clang++ /usr/bin/clang++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/clang++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/clang-${version} 100
|
||||
@@ -1,48 +0,0 @@
|
||||
# Copyright (c) 2022 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:22.04
|
||||
|
||||
# Valid version values:
|
||||
# 11
|
||||
# 12
|
||||
|
||||
ARG version
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && apt -y upgrade && \
|
||||
apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
|
||||
protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
|
||||
doxygen libboost-all-dev libhdf5-serial-dev python3-pydot libpng-dev \
|
||||
gcc-${version} g++-${version} make
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-${version} 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/gcc-${version} 100
|
||||
@@ -1,53 +0,0 @@
|
||||
# Copyright (c) 2024 The Regents of the University of California
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
FROM --platform=${BUILDPLATFORM} ubuntu:22.04
|
||||
|
||||
# Valid version values:
|
||||
# 13
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt -y update && \
|
||||
# software-properties-common is necessary to install
|
||||
# to add PPA to the system
|
||||
apt -y install software-properties-common && \
|
||||
# Installing PPA is necessary to install gcc-13
|
||||
# because it is not available in the default repositories
|
||||
# for Ubuntu 22.04
|
||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
|
||||
apt -y update && \
|
||||
apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
|
||||
protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
|
||||
doxygen libboost-all-dev libhdf5-serial-dev python3-pydot libpng-dev \
|
||||
gcc-13 g++-13 make
|
||||
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/g++ g++ /usr/bin/g++- 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-13 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/c++ c++ /usr/bin/g++-13 100
|
||||
RUN update-alternatives --install \
|
||||
/usr/bin/cc cc /usr/bin/gcc-13 100
|
||||
@@ -52,7 +52,8 @@ RUN apt -y update && apt -y upgrade && apt -y install \
|
||||
pkg-config \
|
||||
wget \
|
||||
cmake \
|
||||
doxygen
|
||||
doxygen \
|
||||
vim
|
||||
|
||||
# pre-commit, as installed via apt in 24.04, attempts to create a cache
|
||||
# directory at "${HOME}/.cache/pre-commit". If running docker with non-root,
|
||||
|
||||
Reference in New Issue
Block a user