Opam switch list-available showing fewer switches when run on arm64

I’ve got an ARM / Apple Silicon / M1 Macbook, and I’m attempting to setup a project for development on it.

Generally, to build compilers and tooling, I’ve slowly learned to use arch -arm64 before commands to ensure they’re not compiling slow, “translated” binaries that run through Rosetta. Unfortunately, I’m running into a weird issue with that at the moment.

I’ve already successfully produced a working OCaml compiler with the following:

arch -arm64 opam switch create default-arm64 4.12.0

However, now that I’m attempting to create a 4.06.1 switch for the actual project I’m working on, I’m running into strange issues:

./bs-slash-create $ arch -arm64 opam switch create bucklescript-arm64 4.06.1
[ERROR] No compiler matching '4.06.1' found, use 'opam switch list-available' to see what is
        available, or use '--packages' to select packages explicitly.

./bs-slash-create $ arch -arm64 opam switch list-available
# ... lists only the latest version of OCaml

./bs-slash-create $ opam switch list-available
# ... lists all versions of OCaml, including 4.06.1

Is there a particular reason opam is refusing to compile OCaml 4.06.1 under ARM? Unless I’m missing something, it looks like OCaml’s compiler has worked on ARM since 3.12, a little over a decade ago.

If it’s a tooling issue, is there a way to coax opam into compiling 4.06.1 on ARM?

Apple Silicon is only supported on 4.10.2 and starting from 4.12

2 Likes

Huh. Are there fundamental architectural reasons for this, or is it just “nobody’s built them specifically on macOS yet?” i.e. is this something for which backwards-compatibility could be retroactively ported? /=

While OCaml supports ARM64 there is differences between OS, the assembler used and ABI. So only 4.10.2 and 4.12 will build on macOS ARM64…

4.06 will just not work