Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install clang-19 and clang-14 on cpubuilder, enabling ASan builds. #6

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Image name | Description | Source Dockerfile
---------- | ----------- | -----------------
`iree-org/amdgpu_ubuntu_jammy_x86_64` | Ubuntu with AMDGPU deps | [Source](./dockerfiles/amdgpu_ubuntu_jammy_x86_64.Dockerfile)
`iree-org/amdgpu_ubuntu_jammy_ghr_x86_64` | Ubuntu with AMDGPU deps (GitHub runner) | [Source](./dockerfiles/amdgpu_ubuntu_jammy_ghr_x86_64.Dockerfile)
`iree-org/cpubuilder_ubuntu_ghr_x86_64` | CPU builder with IREE build deps | [Source](./dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile)
`iree-org/cpubuilder_ubuntu_jammy_ghr_x86_64` | CPU builder with IREE build deps (GitHub runner) | [Source](./dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile)
`iree-org/manylinux_x86_64` | Portable Linux release builder for Python packaging | [Source](./dockerfiles/manylinux_x86_64.Dockerfile)
`iree-org/manylinux_ghr_x86_64` | Portable Linux release builder for Python packaging (GitHub runner) | [Source](./dockerfiles/manylinux_ghr_x86_64.Dockerfile)
Expand All @@ -33,12 +34,21 @@ can be referenced using tags or hashes:

To build locally, use a command like:

```
```bash
sudo docker buildx build --file dockerfiles/some.Dockerfile .
```

This will print a SHA image id, which you can run with:

```
```bash
sudo docker run --rm -it --entrypoint /bin/bash <<IMAGE>>
```

You can also
[tag an image](https://docs.docker.com/get-started/docker-concepts/building-images/build-tag-and-publish-an-image/)
to avoid needing to copy the SHA each time:

```bash
sudo docker buildx build --file dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile . --tag cpubuilder:latest
sudo docker run --rm --mount type=bind,source="realpath(~/iree)",target=/iree -it --entrypoint bash cpubuilder:latest
```
32 changes: 18 additions & 14 deletions dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# GitHub Actions Runner with IREE build deps.
FROM docker.io/myoung34/github-runner:ubuntu-jammy

######## Basic apt packages ########
######## Apt packages ########
RUN apt update && \
apt install -y \
wget git unzip curl gnupg2 lsb-release && \
apt install -y \
ccache clang-14 lld-14 libssl-dev ninja-build libxml2-dev llvm-dev pkg-config \
libcapstone-dev libtbb-dev libzstd-dev
# Python
apt install -y wget git unzip curl gnupg2 lsb-release
# Python 3.
RUN apt install -y python3.11-dev python3.11-venv python3-pip && \
update-alternatives --install /usr/local/bin/python python /usr/bin/python3.11 3 && \
update-alternatives --install /usr/local/bin/python3 python3 /usr/bin/python3.11 3
# Toolchains and build deps
# Toolchains and build dependencies.
RUN apt install -y \
ccache ninja-build clang-14 lld-14 gcc-9 g++-9 \
libssl-dev libxml2-dev libcapstone-dev libtbb-dev libzstd-dev \
llvm-dev pkg-config
# Cleanup
clang-14 lld-14 \
gcc-9 g++-9 \
ccache ninja-build libssl-dev libxml2-dev libcapstone-dev libtbb-dev \
libzstd-dev llvm-dev pkg-config
# Recent compiler tools for build configurations like ASan/TSan.
# * See https://apt.llvm.org/ for context on the apt commands.
ARG LLVM_VERSION=19
RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" >> /etc/apt/sources.list && \
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/llvm-snapshot.gpg && \
apt update && \
apt install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION}
# Cleanup.
RUN apt clean && rm -rf /var/lib/apt/lists/*

######## CMake ########
Expand All @@ -27,12 +31,12 @@ COPY build_tools/install_cmake.sh ./
RUN ./install_cmake.sh "${CMAKE_VERSION}" && rm -rf /install-cmake

######## Build toolchain configuration ########
# Setup symlinks and alternatives.
# Setup symlinks and alternatives then default to using clang-14.
# This can be overriden to gcc or another clang version as needed.
RUN ln -s /usr/bin/lld-14 /usr/bin/lld && \
ln -s /usr/bin/ld.lld-14 /usr/bin/ld.lld && \
ln -s /usr/bin/clang-14 /usr/bin/clang && \
ln -s /usr/bin/clang++-14 /usr/bin/clang++
# Default to using clang. This can be overriden to gcc as desired.
ENV CC=clang
ENV CXX=clang++

Expand Down
34 changes: 19 additions & 15 deletions dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Stock Ubuntu with IREE build deps.
# Stock Ubuntu Jammy (22.04) with IREE build dependencies.
FROM ubuntu:jammy

######## Basic apt packages ########
######## Apt packages ########
RUN apt update && \
apt install -y \
wget git unzip curl gnupg2 lsb-release && \
apt install -y \
ccache clang-14 lld-14 libssl-dev ninja-build libxml2-dev llvm-dev pkg-config \
libcapstone-dev libtbb-dev libzstd-dev
# Python
apt install -y wget git unzip curl gnupg2 lsb-release
# Python 3.
RUN apt install -y python3.11-dev python3.11-venv python3-pip && \
update-alternatives --install /usr/local/bin/python python /usr/bin/python3.11 3 && \
update-alternatives --install /usr/local/bin/python3 python3 /usr/bin/python3.11 3
# Toolchains and build deps
# Toolchains and build dependencies.
RUN apt install -y \
ccache ninja-build clang-14 lld-14 gcc-9 g++-9 \
libssl-dev libxml2-dev libcapstone-dev libtbb-dev libzstd-dev \
llvm-dev pkg-config
# Cleanup
clang-14 lld-14 \
gcc-9 g++-9 \
ccache ninja-build libssl-dev libxml2-dev libcapstone-dev libtbb-dev \
libzstd-dev llvm-dev pkg-config
# Recent compiler tools for build configurations like ASan/TSan.
# * See https://apt.llvm.org/ for context on the apt commands.
ARG LLVM_VERSION=19
RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" >> /etc/apt/sources.list && \
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/llvm-snapshot.gpg && \
apt update && \
apt install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION}
# Cleanup.
RUN apt clean && rm -rf /var/lib/apt/lists/*

######## CMake ########
Expand All @@ -27,12 +31,12 @@ COPY build_tools/install_cmake.sh ./
RUN ./install_cmake.sh "${CMAKE_VERSION}" && rm -rf /install-cmake

######## Build toolchain configuration ########
# Setup symlinks and alternatives.
# Setup symlinks and alternatives then default to using clang-14.
# This can be overriden to gcc or another clang version as needed.
RUN ln -s /usr/bin/lld-14 /usr/bin/lld && \
ln -s /usr/bin/ld.lld-14 /usr/bin/ld.lld && \
ln -s /usr/bin/clang-14 /usr/bin/clang && \
ln -s /usr/bin/clang++-14 /usr/bin/clang++
# Default to using clang. This can be overriden to gcc as desired.
ENV CC=clang
ENV CXX=clang++

Expand Down