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

Enable native linux-aarch64 build #117

Merged
merged 3 commits into from
Jan 17, 2023
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
16 changes: 9 additions & 7 deletions .github/workflows/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 ...
Expand Down
14 changes: 3 additions & 11 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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=//:<target-platform> //pkg/...
$ bazel build :urbit
```

The default optimization level is `-O3`, but if you want to specify a different
Expand Down
2 changes: 1 addition & 1 deletion bazel/toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down