OCaml 4.12.0, second beta release

The release of OCaml 4.12.0 is on the horizon. We have created a new beta
version to help you adapt your software to the new features ahead of the release.

Compared to the first beta release, this new release contains one fix for the
Thread library (for a race condition on Windows), and experimentally re-enables
building the compiler on illumos and Oracle Solaris.

We are expecting this beta to be the last one before the release.

If you find any bugs, please report them here:
Issues · ocaml/ocaml · GitHub

Happy hacking,

– Florian Angeletti for the OCaml team.

Installation instructions

The base compiler can be installed as an opam switch with the following commands

opam update
opam switch create 4.12.0~beta2 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

If you want to tweak the configuration of the compiler, you can pick configuration options with

opam update
opam switch create <switch_name> --packages=ocaml-variants.4.12.0~beta2+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

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

opam switch create 4.12.0~beta2+flambda+afl --packages=ocaml-variants.4.12.0~beta2+options,ocaml-option-flambda,ocaml-option-afl --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

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

The source code is available at these addresses:

https://github.com/ocaml/ocaml/archive/4.12.0-beta2.tar.gz
https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.0~beta2.tar.gz

If you want to test this version, you may want to install the alpha opam repository

with

opam repo add alpha git://github.com/kit-ty-kate/opam-alpha-repository.git

This alpha repository contains various packages patched with fixes in the
process of being upstreamed. Once the repository installed, these patched
packages will take precedence over the non-patched version.

Changes from the first beta

Thread library

  • [additional fixes] 9757, 9846, +10161: check proper ownership when operating over mutexes.
    Now, unlocking a mutex held by another thread or not locked at all
    reliably raises a Sys_error exception. Before, it was undefined
    behavior, but the documentation did not say so.
    Likewise, locking a mutex already locked by the current thread
    reliably raises a Sys_error exception. Before, it could
    deadlock or succeed (and do recursive locking), depending on the OS.
    (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by
    Guillaume Munch-Maccagnoni, David Allsopp, and Stephen Dolan)

Build system

  • 10063: (Re-)enable building on illumos (SmartOS, OmniOS, …) and
    Oracle Solaris; x86_64/GCC and 64-bit SPARC/Sun PRO C compilers.
    (partially revert 2024).
    (Tõivo Leedjärv and Konstantin Romanov,
    review by Gabriel Scherer, Sébastien Hinderer and Xavier Leroy)

Documentation

  • 9755: Manual: post-processing the html generated by ocamldoc and
    hevea. Improvements on design and navigation, including a mobile
    version, and a quick-search functionality for the API.
    (San Vũ Ngọc, review by David Allsopp and Florian Angeletti)

  • 10142, 10154: improved rendering and latex code for toplevel code examples.
    (Florian Angeletti, report by John Whitington, review by Gabriel Scherer)

3 Likes