support building the aarch64 cross-compiler on macOS - #168
Closed
samoht wants to merge 5 commits into
Closed
Conversation
samoht
marked this pull request as draft
June 18, 2026 19:56
samoht
force-pushed
the
macos-cross-build
branch
4 times, most recently
from
June 20, 2026 22:07
f97ad05 to
26f3acf
Compare
This was referenced Jun 21, 2026
samoht
force-pushed
the
macos-cross-build
branch
4 times, most recently
from
June 21, 2026 05:13
bfc2a5c to
df639b7
Compare
samoht
marked this pull request as ready for review
June 22, 2026 16:37
Pass AR and RANLIB to the nolibc and openlibm sub-makes so they use the toolchain archiver (llvm-ar/ranlib) instead of the host default, and add -Wno-asm-operand-widths to the nolibc CFLAGS for clang. On macOS, build the cross OCaml with --othertoolprefix=llvm-, --enable-imprecise-c99-float-ops and --disable-function-sections, drop the native solo5 dependency (which has no macOS build), and mark macos/arm64 as an available platform.
The generated aarch64-solo5-ocaml-<tool> wrappers exec'd the bare tool name (e.g. llvm-ar via --othertoolprefix), so they only worked when that tool's directory was on PATH. On macOS the LLVM binutils live outside the Solo5 toolchain and the opam switch, so a plain `dune build -x` failed to find them. Bake the absolute path that command -v already returns.
samoht
force-pushed
the
macos-cross-build
branch
2 times, most recently
from
June 23, 2026 00:02
b8be574 to
fb145a9
Compare
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build zarith with it: install ocaml-gmp (mirage/ocaml-gmp#29) for its relocatable gmp.pc, then point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` and PKG_CONFIG_PATH at that gmp.pc so zarith's configure (ocaml/Zarith#173) compiles caml_z.c with the cross cc against ocaml-gmp. Drop this commit, or the pins, once the forks are in opam.
samoht
force-pushed
the
macos-cross-build
branch
2 times, most recently
from
June 26, 2026 05:29
c4e986b to
49be517
Compare
The second alternative was missing its operator: {= "5.4.1" | "5.5.0"}
makes opam read "5.5.0" as a bare filter (warning 66). Use
{= "5.4.1" | = "5.5.0"}, as ocaml-solo5.opam already does.
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'd like to build aarch64 Solo5/MirageOS unikernels on an Apple Silicon Mac, instead of going through a Linux VM. This package is the OCaml cross-compiler for that target.
This PR builds it with the macOS LLVM toolchain: it passes the toolchain
ar/ranlibto the nolibc and openlibm makes, adds the matching cross OCaml configure flags, drops the nativesolo5dependency (no macOS build), and marksmacos/arm64available. The generatedaarch64-solo5-ocaml-*wrappers also resolve their tools to absolute paths, so they work offPATH.The rest of the stack:
gmp.pclibgmp.awith the crossar/ranlibOCAML*environment variables in configure