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

Build with bazel on linux-arm64 #16

Merged
merged 17 commits into from
Nov 10, 2022

Conversation

mcevoypeter
Copy link

Description

Resolves #3.

This PR adds support for cross compiling for linux-arm64 on linux-x86_64 using the aarch64-linux-gnu-gcc toolchain. The build processes for curl, gmp, h2o, openssl, secp256k1, sigsegv, softfloat, and uv had to be updated to include explicit cross-compilation support when targeting linux-arm64 from linux-x86_64. Also, a new dependency--sse2neon--was added to translate Intel SSE intrinsics to ARM NEON intrinsics in h2o.

Also added:

  • Support for setting compiler toolchain versions at the command line. Prior to this work, compiler toolchain version numbers were hard-coded into the toolchain configuration in //bazel/toolchain:BUILD.bazel.
  • platform()s with unspecified compilers, specifically linux-x86_64 and linux-arm64. The target platform need not specify a compiler, since the compiler toolchain is only relevant for the host platform.

Testing

Host platform: ThinkPad (x86_64) running Arch Linux with v12.2.0 of aarch64-linux-gnu-gcc installed.

$ bazel build --host_platform=//:aarch64_linux_gnu_gcc-linux-x86_64 --platforms=//:linux-arm64 --aarch64_linux_gnu_gcc_version="12.2.0" :urbit
<snip>
$ file bazel-bin/pkg/vere/urbit
bazel-bin/pkg/vere/urbit: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=2198b5a216e416858b0166bda9c161346c447bdc, for GNU/Linux 3.7.0, not stripped

Note that test targets are not building because of #15, and even if they were, running them on would be difficult given that the linux-arm64 build is cross compiled form a linux-x86_64 machine.

@mcevoypeter mcevoypeter added feature New feature or feature request build Related to the build system labels Nov 10, 2022
@mcevoypeter mcevoypeter marked this pull request as ready for review November 10, 2022 21:41
@mcevoypeter mcevoypeter linked an issue Nov 10, 2022 that may be closed by this pull request
@mcevoypeter mcevoypeter merged commit 78da7f4 into issue/1/bazel-build Nov 10, 2022
@mcevoypeter mcevoypeter deleted the issue/3/build-linux-arm64 branch November 10, 2022 21:43
mcevoypeter added a commit that referenced this pull request Dec 15, 2022
Co-authored-by: Peter McEvoy <git@mcevoypeter.com>
@matthew-levan
Copy link
Contributor

When branching this runtime-specific repo off from the urbit monorepo, we initially based off of next/vere in the monorepo. However, during the course of fall 2022, buggy work ended up on next/vere. Because of this, the release branch for version 1.14 of the runtime branched off of master, not next/vere, leading to a non-trivial divergence between next/vere and master. To that end, we have to rewrite the history of this repo, which will potentially obfuscate the commit SHAs and diffs of the already merged PRs in this repo. To provide a trail of breadcrumbs, attached is a patch of the diff represented by this PR before history was rewritten.

PR16.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to the build system feature New feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build with bazel on linux-arm64
2 participants