Skip to content

Commit

Permalink
Move to llvm 16
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <sean@mess.org>
  • Loading branch information
seanyoung committed Dec 8, 2023
1 parent 0331a84 commit bd500fa
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 36 deletions.
13 changes: 7 additions & 6 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y libz-dev pkg-config libssl-dev git cmake ninja-build gcc g++ python3 file

RUN git clone --single-branch --branch solana-rustc/15.0-2022-12-07 \
RUN git clone --single-branch --branch solana-rustc/16.0-2023-06-05 \
https://github.com/solana-labs/llvm-project.git

WORKDIR /llvm-project

RUN cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off \
-DLLVM_ENABLE_PROJECTS=clang\;lld \
-DLLVM_TARGETS_TO_BUILD=WebAssembly\;SBF \
-DLLVM_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SBF \
-DLLVM_ENABLE_ZSTD=Off \
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/llvm15.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/llvm16.0 llvm

RUN cmake --build . --target install && \
find /llvm15.0/ -type f -executable -exec sh -c "file '{}' | grep -q 'not stripped' " \; -print | xargs strip
find /llvm16.0/ -type f -executable -exec sh -c "file '{}' | grep -q 'not stripped' " \; -print | xargs strip

FROM ubuntu:20.04

Expand All @@ -33,9 +34,9 @@ RUN apt-get update && \
# Get Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain 1.72.0 --profile minimal

COPY --from=builder /llvm15.0 /llvm15.0/
COPY --from=builder /llvm16.0 /llvm16.0/

ENV PATH="/llvm15.0/bin:/root/.cargo/bin:/root/.local/share/solana/install/active_release/bin:${PATH}"
ENV PATH="/llvm16.0/bin:/root/.cargo/bin:/root/.local/share/solana/install/active_release/bin:${PATH}"

# Install Solana (x86-64 only, does not work on arm)
RUN if test `arch` = x86_64; then \
Expand Down
62 changes: 33 additions & 29 deletions .github/workflows/build-llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@ jobs:
uses: actions/checkout@v3.1.0
with:
submodules: recursive
- run: git clone --depth 1 --branch solana-rustc/15.0-2022-12-07 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/16.0-2023-06-05 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_LIBXML2=Off -DLLVM_ENABLE_ZLIB=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;SBF'
-DLLVM_TARGETS_TO_BUILD='WebAssembly'
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SBF
-DLLVM_ENABLE_ZSTD=Off
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm15.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm16.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm15.0-linux-x86-64.tar.xz ./llvm15.0/
- run: tar Jcf ./llvm16.0-linux-x86-64.tar.xz ./llvm16.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm15.0-linux-x86-64.tar.xz
asset_name: llvm15.0-linux-x86-64.tar.xz
file: llvm16.0-linux-x86-64.tar.xz
asset_name: llvm16.0-linux-x86-64.tar.xz
tag: ${{ github.ref }}

linux-arm64:
Expand All @@ -44,23 +45,24 @@ jobs:
uses: actions/checkout@v3.1.0
with:
submodules: recursive
- run: git clone --depth 1 --branch solana-rustc/15.0-2022-12-07 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/16.0-2023-06-05 https://github.com/solana-labs/llvm-project.git
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_LIBXML2=Off -DLLVM_ENABLE_ZLIB=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;SBF'
-DLLVM_TARGETS_TO_BUILD='WebAssembly'
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SBF
-DLLVM_ENABLE_ZSTD=Off
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm15.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm16.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm15.0-linux-arm64.tar.xz ./llvm15.0/
- run: tar Jcf ./llvm16.0-linux-arm64.tar.xz ./llvm16.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm15.0-linux-arm64.tar.xz
asset_name: llvm15.0-linux-arm64.tar.xz
file: llvm16.0-linux-arm64.tar.xz
asset_name: llvm16.0-linux-arm64.tar.xz
tag: ${{ github.ref }}

windows:
Expand All @@ -72,7 +74,7 @@ jobs:
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@1.64.0
- run: git clone --depth 1 --branch solana-rustc/15.0-2022-12-07 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/16.0-2023-06-05 https://github.com/solana-labs/llvm-project.git
# We may not have enough space to compile llvm, see https://github.com/actions/virtual-environments/issues/326
working-directory: C:\
- name: Setup Windows
Expand All @@ -85,17 +87,17 @@ jobs:
-DLLVM_ENABLE_LIBXML2=Off -DLLVM_ENABLE_ZLIB=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_ENABLE_ZSTD=Off
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=C:/llvm15.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=C:/llvm16.0 llvm
working-directory: C:\llvm-project
- run: cmake --build . --target install
working-directory: C:\llvm-project
- run: Compress-Archive -Path C:\llvm15.0 -DestinationPath C:\llvm15.0-win.zip
- run: Compress-Archive -Path C:\llvm16.0 -DestinationPath C:\llvm16.0-win.zip
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: C:\llvm15.0-win.zip
asset_name: llvm15.0-win.zip
file: C:\llvm16.0-win.zip
asset_name: llvm16.0-win.zip
tag: ${{ github.ref }}

mac-arm:
Expand All @@ -107,25 +109,26 @@ jobs:
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@1.64.0
- run: git clone --depth 1 --branch solana-rustc/15.0-2022-12-07 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/16.0-2023-06-05 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_LIBXML2=Off -DLLVM_ENABLE_ZLIB=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;SBF'
-DLLVM_TARGETS_TO_BUILD='WebAssembly'
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SBF
-DLLVM_ENABLE_ZSTD=Off
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm15.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm16.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm15.0-mac-arm.tar.xz ./llvm15.0/
- run: tar Jcf ./llvm16.0-mac-arm.tar.xz ./llvm16.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm15.0-mac-arm.tar.xz
asset_name: llvm15.0-mac-arm.tar.xz
file: llvm16.0-mac-arm.tar.xz
asset_name: llvm16.0-mac-arm.tar.xz
tag: ${{ github.ref }}

mac-intel:
Expand All @@ -140,23 +143,24 @@ jobs:
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@1.64.0
- run: git clone --depth 1 --branch solana-rustc/15.0-2022-12-07 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/16.0-2023-06-05 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_LIBXML2=Off -DLLVM_ENABLE_ZLIB=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;SBF'
-DLLVM_TARGETS_TO_BUILD='WebAssembly'
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SBF
-DLLVM_ENABLE_ZSTD=Off
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm15.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm16.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm15.0-mac-intel.tar.xz ./llvm15.0/
- run: tar Jcf ./llvm16.0-mac-intel.tar.xz ./llvm16.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm15.0-mac-intel.tar.xz
asset_name: llvm15.0-mac-intel.tar.xz
file: llvm16.0-mac-intel.tar.xz
asset_name: llvm16.0-mac-intel.tar.xz
tag: ${{ github.ref }}
2 changes: 1 addition & 1 deletion .github/workflows/ci-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
uses: actions/checkout@v3.1.0
- run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker buildx build --provenance=false --platform linux/amd64,linux/arm64 -t ghcr.io/${GITHUB_REPOSITORY}:ci-6 --push .github
docker buildx build --provenance=false --platform linux/amd64,linux/arm64 -t ghcr.io/${GITHUB_REPOSITORY}:ci-7 --push .github

0 comments on commit bd500fa

Please sign in to comment.