From 4bcbbfc76fc2133fb965409461113f47fa24cb74 Mon Sep 17 00:00:00 2001 From: Peter McEvoy Date: Tue, 17 Jan 2023 12:25:52 -0500 Subject: [PATCH 1/3] Enable linux-aarch64 build and disable cross compilation --- bazel/toolchain/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index aab09bbacf..563ec17e31 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -85,7 +85,7 @@ toolchain( name = "gcc-linux-aarch64-toolchain", exec_compatible_with = [ "@platforms//os:linux", - "@platforms//cpu:x86_64", + "@platforms//cpu:aarch64", ], target_compatible_with = [ "@platforms//os:linux", From de1a0709d6f81e3b773ede8ef1b253adea21593d Mon Sep 17 00:00:00 2001 From: Peter McEvoy Date: Tue, 17 Jan 2023 12:31:13 -0500 Subject: [PATCH 2/3] Remove cross-compilation instructions --- INSTALL.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a326aaa9ee..f98665892f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,7 +8,7 @@ run: ---------------------------------- Host Platform | Target Platform ---------------------------------- - `linux-x86_64` | `linux-aarch64` + `linux-aarch64 | `linux-aarch64` `linux-x86_64` | `linux-x86_64` `macos-aarch64` | `macos-aarch64` `macos-x86_64` | `macos-x86_64` @@ -51,17 +51,9 @@ This will take a few minutes. ## Build Commands -Once you install the prerequisites, you're ready to build. If you're performing -a native build (i.e. one in which the host platform and target platform are the -same), run: +Once you install the prerequisites, you're ready to build: ```console -$ bazel build //pkg/... -``` - -If you're performing a cross-platform build, you need to specify the target -platform in the build command: -```console -$ bazel build --platforms=//: //pkg/... +$ bazel build :urbit ``` The default optimization level is `-O3`, but if you want to specify a different From 675881f5e9383253cd6b377bd2f97b38563f4848 Mon Sep 17 00:00:00 2001 From: Peter McEvoy Date: Tue, 17 Jan 2023 12:35:51 -0500 Subject: [PATCH 3/3] Self-host linux-aarch64 GitHub Actions runner --- .github/workflows/shared.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/shared.yml b/.github/workflows/shared.yml index 1ad55f085c..5eabb8a739 100644 --- a/.github/workflows/shared.yml +++ b/.github/workflows/shared.yml @@ -33,7 +33,9 @@ jobs: fail-fast: false matrix: include: - - { target: linux-aarch64, runner: ubuntu-22.04 } + # GitHub doesn't provide AArch64 Linux machines, so we self-host a + # runner instead. + - { target: linux-aarch64, runner: [self-hosted, Linux, ARM64] } - { target: linux-x86_64, runner: ubuntu-22.04 } # GitHub doesn't provide M1 macOS machines, so we self-host a runner # instead. @@ -49,9 +51,12 @@ jobs: - uses: actions/checkout@v3 - name: chown /usr/local - if: ${{ matrix.target == 'linux-aarch64' || matrix.target == 'linux-x86_64' }} + if: ${{ matrix.target == 'linux-x86_64' }} run: | - # See https://github.com/actions/cache/issues/845. + # See https://github.com/actions/cache/issues/845. Note we don't run + # this on linux-aarch64 because we run on a self-hosted GitHub Actions + # runner for which `/usr/local` has already been `chown`d to the user + # running the GitHub Actions runner. sudo chown -R $(whoami) /usr/local - name: Set up build cache @@ -94,7 +99,7 @@ jobs: echo "${{ inputs.pace }}" > ./PACE case "${{ matrix.target }}" in "linux-aarch64") - bazel build --platforms=//:linux-aarch64 :urbit + bazel build :urbit ;; "linux-x86_64") bazel build :urbit @@ -108,9 +113,6 @@ jobs: esac - name: Run unit tests - # We have no way of running the linux-aarch64 tests on a linux-x86_64 - # machine. - if: ${{ matrix.target != 'linux-aarch64' }} run: | if [[ "${{ matrix.target }}" == "macos-x86_64" ]]; then bazel test --build_tests_only --clang_version=14.0.6 --extra_toolchains=//bazel/toolchain:brew-clang-macos-x86_64-toolchain ...