I’d like to add my own solution using Nix to the mix.
The implementation lives here. It mostly follows Eduardo’s approach (in fact, he helped me set it up).
The way it works: we build an OCaml cross-compiler and then use Nix’s builtin cross-compilation support (along with dune’s -x target
) and multiple findlib toolchains to tie it all together.
My Nix overlays CI, in the same repo, cross-compiles some well-known (to me) OCaml libraries and applications to both musl64 and aarch64-musl.
Happy to answer any questions.