Skip to content

OCaml 5

rubicon requested to merge rubicon/aports:rubicon-ocaml-5.0 into master

Here is OCaml 5. Quoting upstream: "This release sports a full rewrite of its runtime system for shared-memory parallel programming using domains and native support for concurrent programming using effect handlers."

Due to that rewrite, for now, the native code compiler only works under x86_64 and aarch64. So, I have chosen to allow OCaml 4.14 (which will continue to be supported until the version 5 native compiler supports more architectures) and OCaml 5 to co-exist, by installing OCaml 5 binaries into /usr/libexec/ocaml5 and OCaml 5 libraries into /usr/lib/ocaml5.

One of the changes between the OCaml 4 and 5 aports is the removal of the separate -dev subpackages. This greatly simplifies the dependency chain, as we don't have to maintain 2 separate dependency chains for for the main pkg and dev subpkg. (Normally the dependency chain for the main pkg will be maintained by automatic tracing, but this is not available for OCaml libraries.)

I have also tried to enable tests as often as possible. Only adding !check when there are no tests, tests are broken, checkdepends cause circular dependencies or are not yet packaged. I will try to revisit those failing tests when a new version of the compiler or the affected package is released.

I have been using OCaml 5 almost exclusively for about a month, only going back to 4.14 when something crashes or I need support for 32-bit architectures.

As upstream is still discussing whether or not the native code compiler for OCaml 5 will support 32-bit (x86, armhf, armv7 for us), I think we should not rush to upgrade the main OCaml aport to version 5. If we do so, the supported architectures for the OCaml aport will go from 7 (x86, x86_64, armhf, armv7, aarch64, s390x, ppc64le) down to just 2 (x86_64 and aarch64).

Once upstream announces a decision for 32-bit then we can take action. If 32-bit is discontinued, and Alpine's release cycle permits it, then we can replace 4.14 with 5 quickly. If 32-bit is not discontinued, but will take some more time, I think we should wait too, otherwise aports compiled with OCaml like Unison will also only be available on x86_64 and aarch64.

As for the Power and Risc-V architectures, I have heard that there are already plans to reintroduce support for them in later releases of the OCaml 5 series.

Edited by rubicon

Merge request reports