First release candidate for OCaml 5.1.0

The release of OCaml 5.1.0 is imminent.
As a final step, we are publishing a release candidate to check that everything is in order before the release in the upcoming week(s).

If you find any bugs, please report them on OCaml’s issue tracker.

Compared to the beta release, this release contains one safe runtime fix, and two configuration tweaks.

The full change log for OCaml 5.1.0 is available on GitHub
A short summary of the changes since the beta release is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.1.0~rc1

The source code for the release candidate is also directly available on:

Fine-Tuned Compiler Configuration

If you want to tweak the configuration of the compiler, you can switch to the option variant with:

opam update
opam switch create <switch_name> ocaml-variants.5.1.0~rc1+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.1.0~rc1+flambda+nffa ocaml-variants.5.1.0~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.


Changes Since the Beta Release

Bug Fix

  • #12445: missing GC root registrations in runtime/io.c
    (Gabriel Scherer, review by Xavier Leroy and Jeremy Yallop)

Configuration Fix (openBSD)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3
    so that code sections remain readable, as needed for closure marshaling.
    (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and
    Sébastien Hinderer)

Tool Fix (ocamlmktop)

  • #11745, +#12358: Debugger and toplevels: embed printer types rather than
    reading their representations from topdirs.cmi at runtime.
    This change also removes the ocamlmktop initialization module introduced
    in #11382 which was no longer useful.
    This change breaks toplevel scripts relying on the visibility of Topdirs
    in the initial toplevel environment without loading topfind.
    Since the opam default .ocamlinit file loads topfind, it is expected
    that only scripts run with ocaml -noinit are affected.
    For those scripts, accessing Topdirs now requires the compiler-libs
    directory to be added to the toplevel search path with
      #directory "+compiler-libs";;
    

as was already the case for the other modules in the toplevel interface
library.
(Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär and
Gabriel Scherer)

Documentation Changes

  • #12201: in the tutorial on modules, replace priority queue example by
    a simpler example based on FIFO queues.
    (Xavier Leroy, review by Anil Madhavapeddy and Nicolás Ojeda Bär).

  • #12352: Fix a typo in the documentation of Arg.write_arg
    (Christophe Raffalli, review by Florian Angeletti)

12 Likes

It’s nice to see that the issue about distribution size that I pointed in my blog post has been partially addressed, reaching 272 MB instead of 521 MB. It will make it easier to distribute binary versions of the distribution in rustup-like tools.

I am still wondering if these is still space for improvement. In my post, I suggested a few solutions at the end, have they been investigated ?

6 Likes

Is there a corresponding ocaml-manual package in opam? opam install ocaml-manual doesn’t seem to work.

The ocaml-manual package will be published with the full release.

Looking at those suggestions:

  • removing the -linkall flag on ocamlcommon.cma is not straigthforward because the typechecker contains a cycle of dependencies across some compilation units which is currently resolved using backpatching of functions.

  • separate opam package for tools: this is a medium term goal for me and some other people. It would also allow to publish some of the compiler tools (ocamltex, ocamltest) that are not currently distributed at all.

  • one unique executable: another medium-term investigation area. In particular, this is the reason why ocaml basename raises a deprecation warning in OCaml 5 in order to possibly reclaim the ocaml name for such executable.

Modules with such refs should probably be renamed: for example, if module Typecore is such a module, it could be renamed into Typecore_pre, and then Typecore could just be include Typecore_pre;; let () = Typemain.init (), where Typemain.init is the initialization function that sets the refs. This way, there would be no risk of calling it unintialized from outside of the lib.

Using sub-commands would not solve the problem on the short term, as we would still need to keep ocamlc, ocamlopt, ocamldep, etc. for backward compatibility for some time. The solution I had in mind is to match on the executable name to choose the corresponding behavior, and then use symlinks for all executables except one. I have used that solution many times, and it works on most systems.