Skip to content

Commit

Permalink
cross compiling for aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Sep 10, 2024
1 parent a3a4f8a commit da3ade2
Showing 1 changed file with 82 additions and 21 deletions.
103 changes: 82 additions & 21 deletions .github/workflows/create_llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,113 @@ jobs:
create_llvm_cache:
strategy:
matrix:
version: [17, 18]
os: [ubuntu-22.04, cp-graviton]
build_type: [Release, RelAssert]
exclude:
# Temporary to test just graviton
- os: ubuntu-22.04
- os: cp-graviton
version: 17
- os: cp-graviton
build_type: Release
version: 18
# version: [17, 18]
version: [18]
os: [ubuntu-22.04]
# build_type: [Release, RelAssert]
build_type: [Release, ReleaseAssert]
# arch : [ x86_64, aarch64 ]
arch : [aarch64]
include:
# We want to set flags related to particular matrix dimensions. To do this
# we need to create default values first, and then against particular matrix
# dimensions.
# Note that we need to use RelAssert as the cache key matching can match Release against ReleaseAssert
- os_flags:
- arch_flags:
- build_type_flags:
- build_type: RelAssert
build_type_flags: -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
- build_type: Release
build_type_flags: -DCMAKE_BUILD_TYPE=Release
- build_type_flags: -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
build_type: RelAssert
- arch_flags: -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/arm-linux/aarch64-toolchain.cmake"
-DLLVM_TARGET_ARCH=AArch64
-DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-unknown-linux-gnu
-DLLVM_TABLEGEN="$GITHUB_WORKSPACE/build_native/bin/llvm-tblgen"
-DCLANG_TABLEGEN="$GITHUB_WORKSPACE/build_native/bin/clang-tblgen"
arch: aarch64
# - build_type: Release
# build_type_flags: -DCMAKE_BUILD_TYPE=Release
# exclude:
# # For now just do latest llvm with aarch to reduce cache usage.
# - arch: aarch64
# version: 17
# - arch: aarch64
# build_type: Release

runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
steps:
- name: Cache llvm
id: cache
uses: actions/cache@v3
with:
path:
llvm_install/**
key: llvm-${{ matrix.os }}-v${{ matrix.version }}-${{ matrix.build_type }}
key: llvm-${{ matrix.os }}-${{ matrix.arch }}-v${{ matrix.version }}-${{ matrix.build_type }}

- name: Checkout repo
- name: show arch flags
if: steps.cache.outputs.cache-hit != 'true'
run:
echo ${{ matrix.arch_flags }}
# - name: Check ock place
# run: |
# pwd
# ls *
- name: Checkout repo llvm
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: llvm/llvm-project
ref: release/${{matrix.version}}.x

- name: output stuff
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch != 'x86_64' }}
run: |
echo steps.cache.outputs.cache-hit
echo "${{ matrix.arch }}"
- name: Checkout repo ock platform
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch != 'x86_64' }}
uses: actions/checkout@v4
with:
sparse-checkout: |
platform
path: ock
- name: Check llvm place
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch != 'x86_64' }}
run: |
pwd
ls *
ls ock
ls ock/platform
- name: Install Ninja
if: steps.cache.outputs.cache-hit != 'true'
uses: llvm/actions/install-ninja@main

- name: install aarch64 build tools
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch == 'aarch64' }}
run:
sudo apt-get install --yes gcc-11-aarch64-linux-gnu g++-11-aarch64-linux-gnu
- name: Flags checker
if: steps.cache.outputs.cache-hit != 'true'
run:
echo Building on "${{ matrix.os }}" with os_flags "${{ matrix.os_flags}}" extra flags "${{ matrix.build_type_flags}}" and build_type "${{matrix.build_type}}"
echo Building on "${{ matrix.os }}" with os_flags "${{ matrix.os_flags}}" aarch "${{ matrix.arch }}"extra flags "${{ matrix.build_type_flags}}" and build_type "${{matrix.build_type}}"

- name: cmake native for cross
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch != 'x86_64' }}
run:
cmake llvm
-DLLVM_ENABLE_DIA_SDK=OFF
-DLLVM_ENABLE_ZLIB=FALSE
-DLLVM_ENABLE_ZSTD=FALSE
-DLLVM_ENABLE_Z3_SOLVER=FALSE
-DLLVM_ENABLE_PROJECTS="clang;lld"
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64;RISCV"
-Bbuild_native
-GNinja
${{ matrix.build_type_flags }}
${{ matrix.os_flags}}

- name: build native for cross
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch != 'x86_64' }}
run:
ninja -C build_native llvm-tblgen clang-tblgen llvm-config

- name: Run cmake
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -79,6 +138,8 @@ jobs:
-GNinja
${{ matrix.build_type_flags }}
${{ matrix.os_flags}}
${{ matrix.arch_flags}}


- name: Run build on llvm
if: steps.cache.outputs.cache-hit != 'true'
Expand Down

0 comments on commit da3ade2

Please sign in to comment.