Skip to content

Commit aded1cb

Browse files
authored
Restore CentOS 7 build and backfill for release/3.2.x (#5160)
1 parent 9732c04 commit aded1cb

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

.github/workflows/llvm-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
config:
2929
- {runner: 'Ubuntu 20.04', runs_on: 'ubuntu-20.04', target-os: 'ubuntu', arch: 'x64'}
3030
- {runner: 'Ubuntu 20.04 ARM64', runs_on: 'ubuntu-20.04', target-os: 'ubuntu', arch: 'arm64'}
31+
- {runner: 'CentOS 7', runs_on: ['self-hosted', 'CPU'], target-os: 'centos', arch: 'x64'}
3132
- {runner: 'AlmaLinux 8', runs_on: ['self-hosted', 'CPU'], target-os: 'almalinux', arch: 'x64'}
3233
- {runner: 'MacOS X64', runs_on: 'macos-12', target-os: 'macos', arch: 'x64'}
3334
- {runner: 'MacOS ARM64', runs_on: 'macos-12', target-os: 'macos', arch: 'arm64'}
@@ -233,6 +234,30 @@ jobs:
233234
234235
tar czf "${{ env.llvm_install_dir }}.tar.gz" "${{ env.llvm_install_dir }}"
235236
237+
238+
- name: Configure, Build, Test, and Install LLVM (CentOS)
239+
if: matrix.config.target-os == 'centos'
240+
run: |
241+
# if this step crashes, it can leave behind a stale docker container
242+
docker container prune -f
243+
docker rmi -f $(docker images -q)
244+
245+
docker build --tag llvm-build --build-arg llvm_dir=llvm-project \
246+
-f llvm-build/.github/workflows/llvm-build/centos.Dockerfile .
247+
248+
# Create temporary container to copy cache and installed artifacts.
249+
CONTAINER_ID=$(docker create llvm-build)
250+
docker cp "${CONTAINER_ID}:/install" "${{ env.llvm_install_dir }}"
251+
tar czf "${{ env.llvm_install_dir }}.tar.gz" "${{ env.llvm_install_dir }}"
252+
253+
# We remove the existing directory, otherwise docker will
254+
# create a subdirectory inside the existing directory.
255+
rm -rf "${{ env.SCCACHE_DIR }}"
256+
docker cp "${CONTAINER_ID}:/sccache" "${{ env.SCCACHE_DIR }}"
257+
sudo chown -R "$(id -u -n):$(id -g -n)" "${{ env.SCCACHE_DIR }}"
258+
259+
docker rm "${CONTAINER_ID}"
260+
236261
- name: Configure, Build, Test, and Install LLVM (AlmaLinux)
237262
if: matrix.config.target-os == 'almalinux'
238263
run: |
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
FROM centos:7
2+
ARG llvm_dir=llvm-project
3+
# Add the cache artifacts and the LLVM source tree to the container
4+
ADD sccache /sccache
5+
ADD "${llvm_dir}" /source/llvm-project
6+
ENV SCCACHE_DIR="/sccache"
7+
ENV SCCACHE_CACHE_SIZE="2G"
8+
9+
RUN echo -e "[llvmtoolset-build]\nname=LLVM Toolset 13.0 - Build\nbaseurl=https://buildlogs.centos.org/c7-llvm-toolset-13.0.x86_64/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/llvmtoolset-build.repo
10+
11+
# Note: This is required patch since CentOS have reached EOL
12+
# otherwise any yum install setp will fail
13+
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
14+
RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
15+
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
16+
17+
# Install build dependencies
18+
RUN yum install --assumeyes centos-release-scl
19+
20+
# The definition of insanity is doing the same thing and expecting a different result
21+
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
22+
RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
23+
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
24+
25+
RUN yum install --assumeyes --nogpgcheck llvm-toolset-13.0
26+
RUN yum install --assumeyes rh-python38-python-devel rh-python38-python-pip
27+
SHELL [ "/usr/bin/scl", "enable", "llvm-toolset-13.0", "rh-python38" ]
28+
29+
RUN python3 -m pip install --upgrade pip
30+
RUN python3 -m pip install --upgrade cmake ninja sccache
31+
32+
# Install MLIR's Python Dependencies
33+
RUN python3 -m pip install -r /source/llvm-project/mlir/python/requirements.txt
34+
35+
# Configure, Build, Test, and Install LLVM
36+
RUN cmake -GNinja -Bbuild \
37+
-DCMAKE_BUILD_TYPE=Release \
38+
-DCMAKE_C_COMPILER=clang \
39+
-DCMAKE_CXX_COMPILER=clang++ \
40+
-DCMAKE_ASM_COMPILER=clang \
41+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
42+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
43+
-DCMAKE_CXX_FLAGS="-Wno-everything" \
44+
-DCMAKE_LINKER=lld \
45+
-DCMAKE_INSTALL_PREFIX="/install" \
46+
-DLLVM_BUILD_UTILS=ON \
47+
-DLLVM_BUILD_TOOLS=ON \
48+
-DLLVM_ENABLE_ASSERTIONS=ON \
49+
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
50+
-DLLVM_ENABLE_PROJECTS=mlir \
51+
-DLLVM_ENABLE_TERMINFO=OFF \
52+
-DLLVM_INSTALL_UTILS=ON \
53+
-DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" \
54+
/source/llvm-project/llvm
55+
56+
RUN ninja -C build install

cmake/llvm-hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fb4f426c81d7e87dbb30df7abeba15ffc2f9f41a
1+
b5cc222d7429fe6f18c787f633d5262fac2e676f

0 commit comments

Comments
 (0)