Backstage OCaml

RSS

Get updates on experimental releases, work-in-progress, and opportunities to contribute to the development of the OCaml Platform and its infrastructure.

The Merlin team is excited to share that you can now try out an experimental branch of Merlin that leverages OCaml 5's domains and effects! This is Merlin-domains, and we'd love for you to test it and share your feedback.

What is Merlin-domains?

Merlin-domains is an experimental branch that uses domains and effects to implement two optimisations to improve performance in large buffers: partial typing and cancellation.

As a reminder, Merlin is the editor service that powers OCaml's IDE features—if you're using the OCaml Platform extension with VS Code or ocaml-eglot with Emacs, you're already using Merlin under the hood through OCaml LSP Server.

Why This Matters

While Merlin has had relatively few performance complaints over the years, in some contexts like very large files, the parsing-typing-analysis mechanism could sometimes cause slowdowns. The experimental branch addresses this in a clever way.

When you run an analysis command on a very large file, the type-checker will progress up to the location that makes the analysis possible, run the analysis phase, return the result, and then continue typing the file. This separation is made possible through control flow management enabled by effects, with two domains interacting with each other.

The result? Analysis phases become much more efficient! This is a great example of migrating a regular OCaml application to take advantage of multicore.

Learn More at Lambda World

Want to understand the technical details? Sonja Heinze and Carine Morel will present their talk "When magic meets multicore - OCaml and its elegant era of parallelism" at Lambda World, where they'll dive into how this experimental branch works internally.

How to Test It

Currently, the branch is in its incubation phase. To test it, pin the branch in the switches where you want to experiment:

opam pin add https://github.com/ocaml/merlin#merlin-domains

Although this experimental branch passes the test suite, your feedback is very important to help collect potential bugs we may have missed. The team has added a Bug/Merlin-domains label to organize tickets related to this branch.

What's Next

The goal is for this branch to eventually become the main branch, so that all users can benefit from these improvements. The rest of the ecosystem depending on Merlin, including OCaml LSP Server, will be adapted to take full advantage of these new features.

We need you! Try out merlin-domains with your real-world OCaml projects and share your experience on the Discuss thread. Your testing and feedback will help shape the future of Merlin!

The release of OCaml 5.4.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.

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

Compared to the second beta, this release candidate only contains a fix in the TSAN mode, and one metadata fix in the changelog itself. The full change log for OCaml 5.4.0 is available on 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 on opam 2.1 and later:

opam update
opam switch create 5.4.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.4.0~rc1+options <option_list>

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

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

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

After an extended summer break, the release of OCaml 5.4.0 is getting close.

Since there have been a handful of meaningful bug fixes this summer, we are releasing a second beta version of OCaml 5.4.0 to help you update your software and libraries ahead of the release (see below for the installation instructions). More information about the whole release process is now available in the compiler repository.

Compared to the first beta release, this beta release contains four notable bug fixes:

  • one type system bugfix for variance annotation on private types
  • one memory concurrency safety fix for weak pointers
  • two Windows fixes

Those fixes are complemented by:

  • one runtime performance fix
  • three tools and compiler-libs related fixes
  • one error message fix.

The full list of fixes for this second beta is available below.

Overall, this beta release is already quite stable. If the tests for this beta release go well, we are expecting to have a first release candidate in the week of the 22 September, and the full release in the beginning of October.

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

The last progresses on stabilising the ecosystem are still tracked on the opam readiness for 5.4.0 meta-issue.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.4.0 is available on 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 on opam 2.1 and later:

opam update
opam switch create 5.4.0~beta2

The source code for the beta is also available at these addresses:

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.4.0~beta2+options <option_list>

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

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

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


Changes since the first beta

Type system fix

  • #14200, #14202: bad variance check with private aliases
    (Jacques Garrigue, report and review by Stephen Dolan)

Windows fixes

  • #13504, #13625, #14223: Add Thread.set_current_thread_name.
    (Romain Beauxis, review by Gabriel Scherer and Antonin Décimo)

  • #13541, #13777: Using C++11 thread_local causes name-mangling issues when linking with flexlink on Cygwin.
    (Antonin Décimo and David Allsopp, report by Kate Deplaix)

Runtime fixes

  • #14061, #14209: fix a memory-ordering bug in Weak.set that could result in uninitialized memory seen by Weak.get on another domain.
    (Damien Doligez, review by Gabriel Scherer)

  • #14169: runtime, fix cache miss within the stack fragments cache
    (Florian Angeletti, review by Gabriel Scherer)

Tooling fixes

  • #13302, #14236: Store locations of longidents components
    (Ulysse Gérard and Jules Aguillon, review by Jules Aguillon and Florian Angeletti)

  • #12642, #13536, #14184, #14192: in the toplevel, print shorter paths for constructors and labels when only some modules along their path are open.
    (Gabriel Scherer, review by Florian Angeletti)

  • #14196, #14197: ocamlprof: do not instrument unreachable clauses
    (Gabriel Scherer, review by Nicolás Ojeda Bär, report by Ali Caglayan)

Error messages

  • #14214, #14221: fix a confused error message for module inclusions, functor error messages were missing some type equalities potentially leading to nonsensical "type t is not compatible with type t" submessage
    (Florian Angeletti, report by Basile Clément, review by Gabriel Scherer)

We released Dune 3.20.0_alpha1 as a minor alpha release that adds one new feature and fixes a documentation reference:

  • New Feature: Added timeout support for cram tests - you can now specify (timeout <float>) in cram stanzas to automatically terminate tests that run too long
  • Documentation Fix: Corrected a reference in the RPC warning changelog entry

This unstable alpha release builds on alpha0 with minimal changes focused on improving test reliability and documentation accuracy.

See full backstage

Differences Between alpha0 and alpha1:

Added in alpha1:

  • Added a (timeout <float>) field to the (cram) stanza to specify per-test
    time limits. Tests exceeding the timeout are terminated with an error.
    (#12041, @Alizter)

Reference Changes:

  • RPC warning entry changed from referencing issue #11836 in alpha0 to pull request #11833 in alpha1

Dune 3.20.0~alpha0 is now available with several user-facing improvements and fixes.

Summary of Changes

Testing improvements: Individual tests can now be run using named aliases (@runtest-<name>), dune runtest accepts absolute paths and can target specific build contexts, and cram tests have better process cleanup.

New command-line features: dune exec works concurrently with watch mode, dune promote runs while watch mode is active, dune describe location shows executable paths, and --alias/--alias-rec flags provide alternatives to @/@@ syntax.

New variables: Added %{os}, %{os_version}, %{os_distribution}, and %{os_family} variables matching opam equivalents.

Fixes: dune subst properly handles version fields in opam files and works when no version control is detected.

Under the hood: Switched from MD5 to BLAKE3 for better performance, improved s-expression formatting, and added smart handling of transitive dependencies based on compiler capabilities.

Installation

opam install dune.3.20.0~alpha0

This is an alpha release for testing. Report issues on GitHub.

See full backstage

Fixed

  • Stop re-running cram tests after promotion when it's not necessary (#11994,
    @rgrinberg)

  • fix: $ dune subst should not fail when adding the version field in opam
    files (#11801, fixes #11045, @btjorge)

  • Kill all processes in the process group after the main process has
    terminated; in particular this avoids background processes in cram tests to
    stick around after the test finished (#11841, fixes #11820, @Alizter,
    @Leonidas-from-XIV)

Added

  • (tests) stanzas now generate aliases with the test name. To run
    (test (name a)) you can do dune build @runtest-a. (#11558, grants part of #10239,
    @Alizter)

  • Inline test libraries now produce aliases runtest-name_of_lib
    allowing users to run specific inline tests as dune build @runtest-name_of_lib. (#11109, partially fixes #10239, @Alizter)

  • feature: $ dune subst use version from dune-project when no version
    control repository has been detected (#11801, @btjorge)

  • Allow dune exec to run concurrently with another instance of dune in watch
    mode (#11840, @gridbugs)

  • Introduce %{os}, %{os_version}, %{os_distribution}, and %{os_family}
    percent forms. These have the same values as their opam counterparts.
    (#11863, @rgrinberg)

  • Introduce option (implicit_transitive_deps false-if-hidden-includes-supported)
    that is equivalent to (implicit_transitive_deps false) when -H is
    supported by the compiler (OCaml >= 5.2) and equivalent to
    (implicit_transitive_deps true) otherwise. (#11866, fixes #11212, @nojb)

  • Add dune describe location for printing the path to the executable that
    would be run (#11905, @gridbugs)

  • dune runtest can now understand absolute paths as well as run tests in
    specific build contexts (#11936, @Alizter).

  • Added 'empty' alias which contains no targets. (#11556 #11952 #11955 #11956,
    grants #4161, @Alizter and @rgrinberg)

  • Allow dune promote to properly run while a watch mode server is running
    (#12010, @ElectreAAS)

  • Add --alias and --alias-rec flags as an alternative to the @ and @@
    syntax in the command line (#12043, fixes #5775, @rgrinberg)

Changed

  • Format long lists in s-expressions to fill the line instead of
    formatting them in a vertical way (#10892, fixes #10860, @nojb)

  • Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more
    performant and difficult to break than MD5 (#11735, @rgrinberg, @Alizter)

  • Print a warning when dune build runs over RPC (#11836, @gridbugs)

  • Stop emitting empty module group wrapper .js file in melange.emit
    (#11987, fixes #11986, @anmonteiro)

OCaml 5.4.0-beta1

Two months after the release of the first alpha for OCaml 5.4.0, the release of OCaml 5.4.0 is drawing near.

The internal API of the compiler libraries has been frozen, and most core developer tools support (or will support soon) the new version of the compiler. We have thus released a first beta version of OCaml 5.4.0 to help you update your softwares and libraries ahead of the release (see below for the installation instructions).

Compared to the first alpha release, this beta release brings two notable changes. First, this beta partially reverts the changes of symbol names in executable (in order to keep current version of perf working with OCaml executable). Second, this beta fixes a significant performance issue on Apple Silicon macOS.

Beyond these two changes, this first beta release contains a dozen of small bug fixes (from the runtime to the error messages) which is usual for the stage of the release. We are expecting the release candidate to follow this beta release soon in the beginning of August.

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.4.0 meta-issue.

The full release is expected in the middle of August, see the new prospective calendar for more information.

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

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.4.0 is available on 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 on opam 2.1 and later:

opam update
opam switch create 5.4.0~beta1

The source code for the beta is also available at these addresses:

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.4.0~beta1+options <option_list>

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

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

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

See full backstage

Code generation fixes

  • (breaking change) #13050, #14104, +#14143: Use '$' instead of '.' to separate module names in symbol names on macOS and Windows (including the Cygwin backend). This changes mangling of OCaml identifiers on those operating systems from camlModule.name_NNN to camlModule$name_NNN. Additionally it changes the encoding of special characters from $xx (two hex digits) to $$xx (two dollar signs followed by two hex digits). (Tim McGilchrist, with contributions from Xavier Leroy, reviewed by Xavier Leroy, Miod Vallat, Gabriel Scherer, Nick Barnes and Hugo Heuzard)

  • #14088, #14091: fix non-deterministic code generation in matching.ml (backport of rescript-lang/rescript#7557) (Christiano Calgano, review by Gabriel Scherer and Vincent Laviron)

Performance fix

  • #13262, #14074: fix performance issue on Apple Silicon macOS by emitting stlr instead of dmb ishld; str. (KC Sivaramakrishnan, report by François Pottier, analysis by Frédéric Bour, Xavier Leroy, Miod Vallat, Gabriel Scherer and Stephen Dolan, review by Miod Vallat, Vincent Laviron and Xavier Leroy)

Standard library fix:

  • (breaking change) #14124: Do not raise Invalid_argument on negative List.{drop,take}. (Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär)

Runtime fix

  • #14057: Don't update memprof too early at the end of a minor GC. (Nick Barnes, review by Damien Doligez).

  • #13586, #14093: Fix closing an out_channel during flush (Stephen Dolan, report by Jan Midtgaard, investigation by Nick Roberts, review by Antonin Décimo and Miod Vallat)

Error message fixes

  • #13956 Fix a regression introduced in #13308 triggering wrong unused warnings. (Ulysse Gérard, review by Florian Angeletti)

  • #14070: also point to label mismatches in error messages for labelled tuples (Florian Angeletti, review by Gabriel Scherer)

  • #14135: Fix a rare internal typechecker error when combining recursive modules, polymorphic fields or methods, and constrained type parameters. (Florian Angeletti, review by Gabriel Scherer)

Compilerlibs fixes

  • #14105: Fix a loop in Pprintast that could result in a hang when printing constructor (::) in isolation. (Ulysse Gérard, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #14108: toplevel, fix a typo in directive type mismatch (Florian Angeletti, review by Gabriel Scherer)

  • #14101, #14139: define atomic helper types inside caml/misc.h to improve header compatibility with C++ (Florian Angeletti, report by Kate Deplaix, review by Gabriel Scherer)

OCamldoc fix

  • #13896, #14098: ocamldoc, do not wrap module description in a paragraph tag inside the table of modules (Florian Angeletti, report by John Whitington, review by Gabriel Scherer)

This is the first release candidate of opam 2.4.0.

Binaries and full archive are signed by the opam dev team (fingerprint 92C5 26AE 50DF 3947 0EB2 911B ED4C F1CA 67CB AA92).

Please see our blog post for a highlight on the major changes and upgrade instructions.

See full backstage

Changes

  • Fix opam switch create <version> when all compilers of that version are flagged with avoid-version [#6571 @rjbou - fix #6563]
  • Opam update performance: No longer copy VCS directories when adding or updating local non-VCS repositories [#6575 @kit-ty-kate - fix #6560]
  • Do not remove the generated patch file during updates when debug-mode is on [#6575 @kit-ty-kate]

Release script

  • Switch the host of qemu-base-images from gitlab to github [#6510 @kit-ty-kate]
  • Speedup the initial clone of qemu-base-images when missing [#6510 @kit-ty-kate]
  • Update some of the platforms the prebuilt binaries are built on to Alpine 2.21, FreeBSD 14.3, OpenBSD 7.7 and NetBSD 10.1 [#6510 @kit-ty-kate]

Build changes

  • Use coreutils' sha512sum instead of perl's shasum utility when using ./configure --with-cygwin-setup [#6566 @kit-ty-kate - fix #6557]
  • Upgrade the download-if-missing dependencies to dune 3.19.1, opam-file-format 2.2.0, spdx_licenses 1.4.0 and patch 3.0.0 [#6580 @kit-ty-kate]

Testing and documentation

API updates

opam-format

opam-core

This is the first beta release of opam 2.4.0.

Binaries and full archive are signed by the opam dev team (fingerprint 92C5 26AE 50DF 3947 0EB2 911B ED4C F1CA 67CB AA92).

Please see our blog post for a highlight on the major changes and upgrade instructions.

See full backstage

New option/command/subcommand are prefixed with ◈.

Changes

Install of dependencies --deps-only

Behaviour

  • ◈ Change the behaviour of --deps-only, where it no longer requires unicity of package version between the request and the installed packages. In other words, if you have pkg.1 installed, installing dependencies of pkg.2 no longer removes pkg.1. This also allows to install dependencies of conflicting packages when their dependencies are compliant. [#6520 @rjbou]

Fixes

Fixed some bugs in opam install --deps-only (and other commands simulating package pins, such as --depext-only) more visible in 2.4:

  • When a package pkg is already installed and opam install ./pkg --deps is called, if there is a conflict between the installed pkg dependencies and the definition of the local pkg, the conflict was not seen and the already installed pkg was kept [#6530 @rjbou - fix #6529]
  • No longer fetch and write the sources when simulating packages that were already pinned [#6533 @rjbou - fix #6532]
  • opam was triggering the reinstall of the package based on the already pinned packages instead of the expected newly simulated pinned packages [#6522 @rjbou - partial fix #6501]
  • opam was using the opam description of the wrong package in some cases [#6544 @kit-ty-kate - fix #6535]

Reinstall

  • Fix a regression where the internal sources directory was removed unexpectedly on reinstall actions, making opam re-fetch the package [#6550 @rjbou - fix #6551]

Update

Fixed a couple of regressions in opam update:

  • An unexpected stack overflow exception was raised when updating repositories with large files when opam is compiled with OCaml < 5.1 [#6527 @kit-ty-kate - fix #6513]
  • Updating a repository where a line was added at the end of a file without final newline character was making the update fail [#6527 @kit-ty-kate - fix hannesm/patch#28]

Windows

  • Improve the prebuilt Windows binaries by including Cygwin's setup-x86_64.exe in the binary itself as fallback, in case cygwin.com is inaccessible [#6538 @kit-ty-kate]

Build changes

  • Bump the downloaded-if-missing dune to 3.19.0, cppo to 1.8.0, ocamlgraph to 2.2.0, uutf to 1.0.4 and patch to 3.0.0~beta1 [#6527 @kit-ty-kate]
  • Allows ./configure --without-dune to build with OCaml 5.4 [#6527 @kit-ty-kate]
  • Add a --with-cygwin-setup option to the configure script, only available on Windows and disabled by default, which includes the optionally given setup-x86_64.exe binary inside the opam binary. If the option is given without a filename, the file with be fetched from cygwin.com [#6526 @kit-ty-kate @dra27 @rjbou - fix #6498]

Testing and documentation

API updates

opam-client

  • OpamAction.cleanup_artefacts: no longer removes the internal sources directory if the package is installed but not pinned [#6550 @rjbou]

Discuss this post on discuss!

Dune lock directories record the names of any system packages needed to build projects or their dependencies. Currently this information is not portable because Dune only stores the names of system packages within the package repository on the machine where the lock directory is generated. We've recently changed how Dune stores the names of system packages in the Dune Developer Preview so that the names of packages in all known package repositories are stored. This allows a lock directory generated on one machine to be used on a different machine.

Background on depexts in Opam

A system package, or external dependency, or depext as I'll refer to them from now on, is a piece of software which can't be installed by Opam directly, but which must be installed in order for some Opam package to be built or for code in an Opam package to be executed at runtime. These packages must be installed by the system package manager, or by some other non-Opam means such as manually building and installing the package from source. Common types of depext are build tools such as the pkg-config command, often run to determine linker flags while building a package, or shared libraries such as libgtk, which an OCaml project might link against to create GUIs.

Opam usually installs depexts automatically. Opam knows how to invoke many different system package managers (such as apt or pacman), so when installing a package with depexts Opam can run the commands appropriate to the current system to install the required packages using the system's package manager. For this to work, Opam needs to know the name of the package within the package repository appropriate to the current system, and these names can vary from system to system. For example the pkg-config command is in a package named simply pkg-config in the apt package manager on Ubuntu/Debian systems, whereas in the third-party homebrew package manager on MacOS it's in a package named pkgconf. In order to determine the right package name for the current system, the package metadata for Opam packages with depexts contains a list of all the different known package names along with the conditions under which that name is correct. Here is that list for the conf-pkg-config Opam package:

depexts: [
  ["pkg-config"] {os-family = "debian" | os-family = "ubuntu"}
  ["pkgconf"] {os-distribution = "arch"}
  ["pkgconf-pkg-config"] {os-family = "fedora"}
  ["pkgconfig"] {os-distribution = "centos" & os-version <= "7"}
  ["pkgconf-pkg-config"] {os-distribution = "mageia"}
  ["pkgconfig"] {os-distribution = "rhel" & os-version <= "7"}
  ["pkgconfig"] {os-distribution = "ol" & os-version <= "7"}
  ["pkgconf"] {os-distribution = "alpine"}
  ["pkg-config"] {os-distribution = "nixos"}
  ["pkgconf"] {os = "macos" & os-distribution = "homebrew"}
  ["pkgconfig"] {os = "macos" & os-distribution = "macports"}
  ["pkgconf"] {os = "freebsd"}
  ["pkgconf-pkg-config"] {os-distribution = "rhel" & os-version >= "8"}
  ["pkgconf-pkg-config"] {os-distribution = "centos" & os-version >= "8"}
  ["pkgconf-pkg-config"] {os-distribution = "ol" & os-version >= "8"}
  ["system:pkgconf"] {os = "win32" & os-distribution = "cygwinports"}
  ["pkgconf"] {os-distribution = "cygwin"}
]

depexts in Dune

Dune doesn't install depexts automatically as the Dune developers are a little nervous about running commands that would modify the global system state. This may change at some point, but for now Dune only provides support for listing the names of depexts, leaving it up to the user to install them as they see fit.

The dune show depexts command can be used to list the depexts of a project. For that command to work the project must have a lock directory. Here's an example of listing the depexts of a project:

$ dune pkg lock
...
$ dune show depexts
libao
libffi
pkgconf
sdl2

I ran these commands on a Mac with homebrew installed, so the package names are from the homebrew package repo. Each package listed there is one of the depexts of a package whose lockfile appears in the project's lock directory. Let's look at how this information is stored. Using pkg-config as an example:

$ cat dune.lock/conf-pkg-config.pkg
(version 4)

(build
 (run pkgconf --version))

(depexts pkgconf)

The relevant part for us is the depexts field. The current released version of Dune only stores the package's depexts for the system where dune pkg lock was run. The command dune show depexts simply concatenates the depexts fields from each lockfile in the lock directory.

When thinking about portable lock directories I always like to imagine what the experience would be using Dune for a project where the lock directory is checked into version control. I frequently switch between using two different machines for development - one running Linux and the other running MacOS. If I was to check in the lock directory I just generated on my Mac, and then check it out on Linux and continue development, dune show depexts would show me a list of packages for the wrong system!

Portable depexts in Dune

To make depexts portable, one's first instinct might be to use the same approach as taken with the depends field outlined in a previous post, listing the depexts for each platform for which the solver was run. Indeed such a change was added to the Dune Developer Preview when we first introduced portable lock directories, however we quickly realized a problem.

The depends, build, and install fields of a package rarely vary between OS distribution. It's reasonably common for those fields to be different on different OSes, but very rare for them to also be different on different OS distributions. As such, it's expected that users will elect to solve their projects for each common OS, but there would be little value in solving projects for each OS distro. In fact solving for multiple distros would slow down solving and bloat the lock directory, and users would somehow need to come up with a definitive list of distros to solve for.

But the depexts field is highly-dependent on the OS distro since package names are specific to the package repository for a particular distro. Recall that the depexts field in Opam package metadata lists package names along with the conditions under which that package name should be used, e.g.:

["pkg-config"] {os-family = "debian" | os-family = "ubuntu"}
["pkgconf"] {os-distribution = "arch"}
["pkgconf-pkg-config"] {os-family = "fedora"}
["pkgconfig"] {os-distribution = "centos" & os-version <= "7"}

These conditions almost always involve the name of the OS distro, and to make matters worse they also sometimes involve the OS version, as packages can change their names between different versions of the same OS. Evaluating these conditions at solve time for platforms with no distro or version specified tends to result in lockfiles with no depexts at all, since all the conditions evaluate to false.

The use case we have in mind for depexts in Dune is that a user will solve their project coarsely, usually just for each common OS with no consideration for distribution or version. Then when they run dune show depexts, the depexts will be listed using names appropriate to the current machine. This means Dune needs to store enough metadata about depexts to compute system-specific depext names at a later time. This means storing the same names and conditions as are currently stored in Opam files, and deferring evaluation of the conditions until as late as possible, such as right when dune show depexts is run.

The latest version of the Dune Developer Preview does just this; translating the depexts field from each package's Opam file into a Dune-friendly S-expression. After this change, the depexts field of conf-pkg-config's lockfile is:

$ cat dune.lock/conf-pkg-config.4.pkg
...
(depexts
 ((pkg-config)
  (or_absorb_undefined_var
   (= %{os_family} debian)
   (= %{os_family} ubuntu)))
 ((pkgconf)
  (= %{os_distribution} arch))
 ((pkgconf-pkg-config)
  (= %{os_family} fedora))
 ((pkgconfig)
  (and_absorb_undefined_var
   (= %{os_distribution} centos)
   (<= %{os_version} 7)))
 ((pkgconf-pkg-config)
  (= %{os_distribution} mageia))
 ((pkgconfig)
  (and_absorb_undefined_var
   (= %{os_distribution} rhel)
   (<= %{os_version} 7)))
 ((pkgconfig)
  (and_absorb_undefined_var
   (= %{os_distribution} ol)
   (<= %{os_version} 7)))
 ((pkgconf)
  (= %{os_distribution} alpine))
 ((pkg-config)
  (= %{os_distribution} nixos))
 ((pkgconf)
  (and_absorb_undefined_var
   (= %{os} macos)
   (= %{os_distribution} homebrew)))
 ((pkgconfig)
  (and_absorb_undefined_var
   (= %{os} macos)
   (= %{os_distribution} macports)))
 ((pkgconf)
  (= %{os} freebsd))
 ((pkgconf-pkg-config)
  (and_absorb_undefined_var
   (= %{os_distribution} rhel)
   (>= %{os_version} 8)))
 ((pkgconf-pkg-config)
  (and_absorb_undefined_var
   (= %{os_distribution} centos)
   (>= %{os_version} 8)))
 ((pkgconf-pkg-config)
  (and_absorb_undefined_var
   (= %{os_distribution} ol)
   (>= %{os_version} 8)))
 ((system:pkgconf)
  (and_absorb_undefined_var
   (= %{os} win32)
   (= %{os_distribution} cygwinports)))
 ((pkgconf)
  (= %{os_distribution} cygwin)))

That's a 1:1 translation of the depexts field from conf-pkg-config's Opam file. There's enough information there so that the appropriate package name can be computed on demand rather than just at solve time.

This bring us a step closer to a world where Dune users can check their lock directories into version control with confidence that their builds are reproducible across different platforms. To try out the latest version of the Dune Developer Preview, go to preview.dune.build.

Four months after the release of OCaml 5.3.0, the set of new features for the future version 5.4.0 of OCaml has been frozen. We are thus happy to announce the first alpha release for OCaml 5.4.0.

This alpha version is here to help fellow hackers join us early in our bug hunting and opam ecosystem fixing fun (see below for the installation instructions).

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.4.0 meta-issue.

The full release is expected around the end of July.

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

If you are interested in the ongoing list of new features and bug fixes, you can have a look at the changelog for OCaml 5.4.0.

Happy hacking, Florian Angeletti for the OCaml team

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.4.0~alpha1

The source code for the alpha is also available at these addresses:

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.4.0~alpha1+options <option_list>

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

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

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

Dune 3.19.0~alpha0 is now available. This alpha release includes several bug fixes and new features for OCaml developers.

Bug Fixes

This release addresses several issues that affected build reliability and functionality:

  • Cram tests: Fixed duplicate execution of cram tests attached to multiple aliases
  • pkg-config integration: Resolved missing --personality flag in pkgconfig invocations that prevented library detection in certain contexts
  • Foreign libraries: Fixed evaluation of enabled_if conditions when computing stubs for foreign_library stanzas
  • Preprocessing: Corrected dune describe pp behavior for libraries using (include_subdirs unqualified)
  • Git integration: Fixed dune subst functionality in subdirectories of git repositories
  • Windows compatibility: Resolved crash in Path.drop_prefix when using Melange on Windows

New Features

  • Dependency validation: Added automatic detection and warnings for common typos in package dependency constraints
  • Foreign library support: Added (extra_objects) field to (foreign_library) stanza with (:include) support

Improvements

  • RPC server: Enhanced RPC server to handle build messages in eager watch mode and support concurrent builds

Installation

Install via opam:

opam install dune.3.19.0~alpha0

As this is an alpha release, please test thoroughly before using in production environments. Bug reports and feedback are welcome on the Dune issue tracker.

For the complete list of changes with pull request references, see the release notes.

See full backstage

Fixed

  • Fixed a bug that was causing cram tests attached to multiple aliases to be run multiple
    times. (#11547, @Alizter)

  • Fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality
    flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

  • Fix: Evaluate enabled_if when computing the stubs for stanzas such as
    foreign_library (#11707, @Alizter, @rgrinberg)

  • Fix $ dune describe pp for libraries in the presence of (include_subdirs unqualified) (#11729, fixes #10999, @rgrinberg)

  • Fix $ dune subst in sub directories of a git repository (#11760, fixes
    #11045, @Richard-Degenne)

  • Fix a crash involving Path.drop_prefix when using Melange on Windows
    (#11767, @nojb)

Added

  • Added detection and warning for common typos in package dependency
    constraints (#11600, fixes #11575, @kemsguy7)

  • Added (extra_objects) field to (foreign_library) stanza with (:include) support.
    (#11683, @Alizter)

Changed

  • Allow build RPC messages to be handled by dune's RPC server in eager watch
    mode (#11622, @gridbugs)

  • Allow concurrent build with RPC server (#11712, @gridbugs)

Discuss this post on Discuss!

We've recently made a change to how lock directories work in the Dune Developer Preview.

Previously when Dune would solve dependencies for a project and generate a lock directory, the lock directory would be specialized for the computer where it was generated, with no guarantee it would work on a different computer. This posed a problem for checking lock directories into version control for projects with multiple developers, since one developer might lock the project on their Mac, say, only for another developer on Linux to be unable to build it due to its MacOS-specific lock directory.

This post is to announce that Dune now supports generating portable lock directories; a lock directory generated on one computer will now contain a dependency solution for a range of different computers, making it safe to check lock directories into version control.

Technical Details

In Opam the dependencies of a package can be different depending on properties of the computer where the package is being installed. A package might have a different set of dependencies when being installed on MacOS verses Linux versus Windows, or the dependencies might vary depending on the CPU architecture. It's even possible (though quite rare in practice) for the dependencies of a package to vary between operating system distributions, or even operating system versions.

This expressive power makes Opam very flexible as it allows packages to be specialized for the environment where they will be installed. The drawback of this approach is that there might not be a single solution to a dependency problem that works everywhere. Each combination of OS/architecture/distro/version could, in theory, require a different dependency solution. There are way too many combinations of those properties to run Dune's dependency solver once for each combination in a reasonable amount of time. Instead we elected to compromise and have Dune only generate a solution for common platforms by default, while allowing users to specify a custom list of platforms to solve for in their dune-workspace file.

Lockfiles now look a little different to account for the fact that they now contain multiple different platform-specific dependency solutions. For example, formerly, the lockfile for the ocaml-compiler package on an x86 machine running Windows, you might have had a depends field like:

(depends arch-x86_64 system-mingw mingw-w64-shims flexdll)

Most of these dependencies are specific to Windows; it's unlikely that you'll be able to install any of these dependencies on Linux or MacOS.

With the portable lock directories feature enabled, this field now might look like:

(depends
 (choice
  ((((arch x86_64)
     (os linux))
    ((arch arm64)
     (os linux))
    ((arch x86_64)
     (os macos)
     (os-distribution homebrew)
     (os-family homebrew))
    ((arch arm64)
     (os macos)
     (os-distribution homebrew)
     (os-family homebrew)))
   ())
  ((((arch x86_64)
     (os win32)
     (os-distribution cygwin)
     (os-family windows)))
   (arch-x86_64 system-mingw mingw-w64-shims flexdll))
  ((((arch arm64)
     (os win32)
     (os-distribution cygwin)
     (os-family windows)))
   (system-mingw mingw-w64-shims flexdll))))

This new syntax is similar to a match-statement, listing the dependencies for each platform for which Dune's solver ran. You can change the platforms Dune will solve for by adding something like this to dune-workspace:

(lock_dir
 (solve_for_platforms
  ((arch arm64)
   (os openbsd))
  ((arch x86_32)
   (os win32))))

After running dune pkg lock again, the lockfile for ocaml-compiler will be updated with these dependencies:

(depends
 (choice
  ((((arch arm64) (os openbsd))) ())
  ((((arch x86_32)
     (os win32)))
   (system-mingw ocaml-option-bytecode-only flexdll))))

A few other fields of lockfiles now also use the new syntax. Dune lockfiles contain the commands needed to build and install each package, as well as the names of any system packages needed by the Opam package, and each of these fields can also have platform-specific values.

Lockfile names now include the version number of the package. The ocaml-compiler package used to have a lockfile named ocaml-compiler.pkg but now has a name like ocaml-compiler.5.3.0.pkg instead. This is because it's possible that different platforms may require different versions of the same package in the dependency solution, so the lock directory needs to be able to contain multiple lockfiles for the same package without them colliding on filename.

How do I get it?

This feature is live in the latest version of the Dune Developer Preview. Follow the instructions on that page to install a version of Dune with this feature. With portable lock directories enabled, Dune will temporarily remain backwards compatible with the original lock directory format, though support will likely be dropped at some point. Generate a new lock directory by running dune pkg lock. You'll know your lock directory is portable if each file inside it has a version number in its filename.

Happy reproducible building!

This is the second alpha release of opam 2.4.0.

Binaries and full archive are signed by the opam dev team (fingerprint 92C5 26AE 50DF 3947 0EB2 911B ED4C F1CA 67CB AA92).

Please see our blog post for a highlight on the major changes and upgrade instructions.

See full backstage

Changes

  • Do not include compiler packages flagged with avoid-version/deprecated in the generated invariant when calling opam switch create [name] <version> [#6494 @kit-ty-kate]
  • Cygwin: Fallback to the existing setup-x86_64.exe if its upgrade failed to be fetched [#6482 @kit-ty-kate - fix #6495, partial fix #6474]
  • Fix a memory leak happening when running large numbers of commands or opening large number of opam files [#6485 @hannesm - fix #6484]
  • Remove handling of the OPAMSTATS environment variable [#6485 @hannesm]

Regression fixes from 2.4.0~alpha1

  • Fix a crash when updating a repository that is deleting or adding empty files [#6490 @kit-ty-kate]
  • Fix an extreme performance issue (takes several hours) when applying a large repository update [#6490 @kit-ty-kate]
  • Fix a crash when updating a git repository that moved a file to a new directory [#6490 @kit-ty-kate]

Build changes

Testing and documentation

API updates

opam-core

  • OpamArg.environment_variable: make STATS as removed from cli 2.3 [#6485 @rjbou]
  • OpamClientConfig: remove STATS variant and related print_stats field in config record [#6485 @hannesm]

opam-format

opam-core

  • OpamSystem: remove print_stats function [#6485 @hannesm]
  • OpamSystem: add the rmdir_cleanup function [#6490 @kit-ty-kate]
  • OpamSystem.dir_is_empty: Speedup and change its type to handle unreachable directories better [#6490 @kit-ty-kate]
  • OpamSystem.internal_patch: remove parent directories when all of their content has been moved somewhere else [#6490 @kit-ty-kate]
  • OpamSystem.internal_patch: fix moving files to new directories when receiving a git diff [#6490 @kit-ty-kate]

This is the first alpha release of opam 2.4.0.

Binaries and full archive are signed by the opam dev team (fingerprint 92C5 26AE 50DF 3947 0EB2 911B ED4C F1CA 67CB AA92).

Please see our blog post for a highlight on the major changes and upgrade instructions.

See full backstage

Possibly scripts breaking changes are prefixed with ✘.
New option/command/subcommand are prefixed with ◈.

Major changes

Init

  • Remove ocaml-system from the list of default compilers chosen at opam init time [#6307 @kit-ty-kate - fix #3509]

Patch: update & install

  • Patches are now applied using the patch OCaml library instead of GNU Patch [#5892 @kit-ty-kate - fix #6019 #6052 #3782 ocaml/setup-ocaml#933]
    • Context diffs are not supported anymore, only Unified diffs are (including its git extensions)
    • Stop support of file permission changes via git extension to the unified diff specification
    • GNU patch and the diff command are no longer runtime dependencies

Depexts

Show

  • opam show now displays the version number of packages flagged with avoid-version/deprecated gray [#6358 @kit-ty-kate - fix #6354]

Install

  • Fix opam install <local_dir> not updating or storing pinned packages' metadata [#6209 @kit-ty-kate - fix #5567]
  • Fix opam install --deps-only/--show-action <local_dir> not updating (without storing) pinned packages' metadata [#6209 @kit-ty-kate - fix #5567]

Pin

  • ✘ Fail when trying to pin a package whose definition could not be found instead of forcing interactive edition (e.g. this could happen when making a typo in the package name of a pin-depends) [#6319 @kit-ty-kate - fix #6322]
  • opam pin/opam pin list now displays the current revision of a pinned repository in a new column [#6274 @desumn - fix #5533]

Admin

  • ◈ Add opam admin compare-versions to compare package versions for sanity checks [#6197 @mbarbin]
  • ◈ Add opam admin migrate-extrafiles which moves all extra-files of an existing opam repository into extra-sources [#5960 @hannesm @rjbou @kit-ty-kate]
  • ✘ The -i/--ignore-test-doc argument has been removed from opam admin check [#6335 @kit-ty-kate]
  • opam admin check now sets with-test and with-doc to false instead of true [#6335 @kit-ty-kate]

Miscellaneous changes

Global CLI

Install

  • Remove the build directories of pinned packages after successful builds [#6436 @kit-ty-kate]

UI

Switch

  • Fix opam switch remove <dir> failure when it is a linked switch [#6276 @btjorge - fix #6275]
  • Fix opam switch list-available when given several arguments [#6318 @kit-ty-kate]
  • Correctly handle pkg.version pattern in opam switch list-available [#6186 @arozovyk - fix #6152]

Upgrade

  • Do not show the not-up-to-date message with packages tagged with avoid-version/deprecated [#6273 @kit-ty-kate - fix #6271]
  • Fix a regression on opam upgrade <package> upgrading unrelated packages [#6373 @AltGr]
  • Fix a regression on opam upgrade --all <uninstalled-pkg> not upgrading the whole switch [#6373 @kit-ty-kate]

Source

  • ◈ Add options --require-checksums and --no-checksums to harmonise with opam install [#5563 @rjbou]

Lint

  • ◈ Add W74 to opam lint to detect pin-depends packages that are neither present in the depends no depopts field [#6317 @rjbou - fix #5795]
  • ◈ Add E63 to opam lint to check for availability guard in case an opam file contains a subpath field [#6438 @rjbou @kit-ty-kate]

Lock

  • Fix pin-depends for with-* dependencies when creating a lock file [#5471 @rjbou - fix #5428]
  • ◈ Add opam lock --keep-local to keep local pins url in pin-depends field [#6411 @rjbou - fix #4897]

Env

  • Add the OPAMSOLVERTOLERANCE environment variable to allow users to fix solver timeouts for good [#5510 @kit-ty-kate - fix #3230]
  • Don't write empty environment update segments to variables.sh (FOO += "" no longer adds FOO='':"$FOO"; export FOO;) [#6198 @dra27]

Sandbox

Software Heritage

  • Rework Software heritage fallback to have a more correct archive retrieval and more fine grained error handling [#6036 @rjbou - fix #5721]
  • Fix Software Heritage liveness check [#6036 @rjbou - fix #5721]
  • Update the Software Heritage API requests [#6036 @rjbou]
  • Remove wget support for Software Heritage fallback [#6036 @rjbou - fix #5721]

Repository

  • Fix curl download command selection when loaded from global config file [#6302 @rjbou]
  • Check that the repositories given to opam repository remove actually exist [#5014 @kit-ty-kate - fixes #5012]
  • ✘ Symlinks in repositories are no longer supported [#5892 @kit-ty-kate]
  • Fix subpath handling in opam files defining a local archive [#6439 @rjbou]

Init

External dependencies (depexts)

  • ◈ Add apt-rpm/ALTLinux family support for depexts [#6207 @RiderALT]
  • Fix the detection of installed external packages on OpenBSD to not just consider manually installed packages [#6362 @semarie]
  • Speedup the detection of available system packages with pacman and brew [#6324 @kit-ty-kate]
  • Change probing tool for SUSE-based distributions from zypper to rpm [#6464 @kit-ty-kate]
  • Disable the detection of available system packages on SUSE-based distributions [#6464 @kit-ty-kate]
  • Add support for stateless depexts systems, by keeping synchronised already installed systems dependencies with switch state [#5982 @RyanGibb @rjbou @kit-ty-kate]

Pin

Build changes

  • Simplify the making of stripped binaries by introducing the make opam-stripped target [#6208 @kit-ty-kate]
  • Fix compilation on macOS with OCaml 5.3 by bumping the downloaded-if-missing mccs to 1.1+19 [#6192 @kit-ty-kate]
  • Upgrade the downloaded-if-missing opam-file-format to 2.2.0~alpha1, spdx_licenses to 1.3.0 and dune to 3.16.1 [#6321 #6370 #6192 @kit-ty-kate - fix #6369]
  • menhir is now part of the transitive dependency of opam (via opam-file-format) [#6321 @kit-ty-kate]

Admin

Download

  • Add fetch on DragonFlyBSD and ftp on NetBSD to the list of download tools to use, if available [#6304 #6305 @kit-ty-kate]
  • Prefer curl over any other download tools on every systems, if available [#6305 @kit-ty-kate]
  • Avoid issues when using wget2 as download-tool where the requested url might return an HTML page instead of the expected content [#6303 @kit-ty-kate]

Internal

  • Allow running some opam commands on machines with limited amount of memory by running Gc.compact while the main process is waiting for the children processes [#5396 @kkeundotnet]
  • Use a C stub to call the uname function from the C standard library instead of calling the uname POSIX command [#6217 @kit-ty-kate]
  • Only download Cygwin's setup.exe when the command is actually going to be displayed or used [#6467 @kit-ty-kate]

Testing and documentation

API updates

opam-client

  • OpamAction.prepare_package_build: now returns exn option instead of exn option OpamProcess.job and no longer calls the system GNU Patch [#5892 @kit-ty-kate]
  • OpamArg.InvalidCLI: export exception [#6150 @rjbou]
  • OpamArg.hash_kinds: was added [#5960 @kit-ty-kate]
  • OpamArg: export require_checksums and no_checksums, that are shared with build_options [#5563 @rjbou]
  • OpamAuxCommands.{simulate_autopin,autopin ~simulate:true}: now updates the reinstall field of the returned switch_state if necessary [#6209 @kit-ty-kate]
  • OpamLockCommand.lock_opam: add ~keep_local argument to add local pins to pin-depends (and not resolve them) [#6411 @rjbou]
  • OpamLockCommand.lock_opam: make the ?only_direct argument non-optional [#6411 @kit-ty-kate]
  • OpamRepositoryCommand.switch_repos: expose the function [#5014 @kit-ty-kate]
  • OpamSolution.install_depexts: instead of the package set of new package to install, now takes 2 labelled arguments pkg_to_install and pkg_installed to be able to keep synchronised stateless depext systems [#5982 @rjbou @RyanGibb @kit-ty-kate]
  • OpamSolution.install_sys_packages: no longer takes set of package to install but OpamSysPkg.to_install [#5982 @rjbou @RyanGibb @kit-ty-kate]
  • OpamSolution.print_depext_msg: takes now an OpamSysPkg.status instead of sets [#5982 @kit-ty-kate @RyanGibb]

opam-repository

  • OpamDownload.download: more fine grained HTTP request error code detection for curl [#6036 @rjbou]
  • OpamDownload.get_output: fix wget option for POST requests [#6036 @rjbou]
  • OpamDownload.get_output: use long form for curl POST request option [#6036 @rjbou]
  • OpamLocal.pull_url: fix subpath handling when the url is a local archive [#6439 @rjbou]
  • OpamRepository.revision: now returns a string instead of a version [#6409 @kit-ty-kate]
  • OpamRepositoryBackend.S.revision: now returns a string instead of a version [#6409 @kit-ty-kate]
  • OpamRepositoryBackend.get_diff: now raises Stdlib.Failure if an unsupported file type or comparison is detected [#5892 @kit-ty-kate]
  • OpamRepositoryBackend.get_diff: now returns exn option instead of exn option OpamProcess.job and no longer calls the system diff utility [#5892 @kit-ty-kate]

opam-state

  • OpamStateConfig: Make the ?lock_kind parameters non-optional to avoid breaking the library users after they upgrade their opam root [#5488 @kit-ty-kate]
  • OpamSwitchState.load_selections: Make the ?lock_kind parameter non-optional to avoid breaking the library users after they upgrade their opam root [#5488 @kit-ty-kate]
  • OpamSysInteract.Cygwin.check_setup: unexpose the function [#6467 @kit-ty-kate]
  • OpamSysInteract.package_manager_name: no longer build the command, or run an action to retrieve system package manager name [#5982 @rjbou]
  • OpamSysInteract.package_status: SUSE-based distributions now uses rpm instead of zypper and no longer return an available set of system packages [#6464 @kit-ty-kate]
  • OpamSysInteract.packages_status: returns now a OpamSysPkg.status instead of sets [#5982 @kit-ty-kate @RyanGib]
  • OpamSysInteract.{install_packages_commands,install}: no longer takes set of package to install but OpamSysPkg.to_install` [#5982 @rjbou @RyanGibb @kit-ty-kate]
  • OpamSysInteract.{install_packages_commands,install}: takes a new argument, a switch stat option, for stateless systems that need to write on switch [#5982 @RyanGibb @rjbou]
  • OpamSysInteract: add stateless_install that return if system package manager is stateless one (per switch) [#5982 @rjbou]

opam-format

  • OpamFile.OPAM.{*read*,write*}: Stop modifying the available field when handling the builtin x-* fields [#6438 @kit-ty-kate]
  • OpamFile.Repos_config.t: change the type to not allow repositories without an URL [#6249 @kit-ty-kate]
  • OpamFormula.all_relop: a list of all operators [#6197 @mbarbin]
  • OpamFormula.string_of_relop: export function [#6197 @mbarbin]
  • OpamPath: add nix_env inner switch path for nix environment [#5982 @RyanGibb]
  • OpamSysPkg; add new type to_install to store system package to install information, newly requested ones and already installed required ones ; and its empty recode to_install_empty and display function string_of_to_install [#5982 @rjbou]

opam-core

  • OpamConsole.pause: Ensure the function always prints a newline character at the end [#6376 @kit-ty-kate]
  • OpamConsole: Replace black text style (unused and not very readable) by gray [#6358 @kit-ty-kate]
  • OpamFilename.patch: a named-parameter ~allow_unclean was added [#5892 @kit-ty-kate]
  • OpamFilename.patch: now returns exn option instead of exn option OpamProcess.job and no longer calls the system GNU Patch [#5892 @kit-ty-kate]
  • OpamHash.all_kinds: was added, which returns the list of all possible values of OpamHash.kind [#5960 @kit-ty-kate]
  • OpamParallel.*.{map,reduce,iter}: Run Gc.compact when the main process is waiting for the children processes for the first time [#5396 @kkeundotnet]
  • OpamStd.List.split: Improve performance [#6210 @kit-ty-kate]
  • OpamStd.Option.equal_some: was added, which tests equality of an option with a value [#6381 @kit-ty-kate]
  • OpamStd.Sys.get_freebsd_version: was added, which returns the output of the uname -U command [#6217 @kit-ty-kate]
  • OpamStd.Sys.get_long_bit: was added, which returns the output of the getconf LONG_BIT command [#6217 @kit-ty-kate]
  • OpamStd.Sys.getconf: was removed, replaced by get_long_bit [#6217 @kit-ty-kate]
  • OpamStd.Sys.uname: now returns the memoized result of the uname function from the C standard library [#6217 @kit-ty-kate]
  • OpamSystem.get_files: was exposed which returns the list of files (without prefix) inside the given directory [#5892 @kit-ty-kate]
  • OpamSystem.patch: a named-parameter ~allow_unclean was added [#5892 @kit-ty-kate]
  • OpamSystem.patch: do not remove the original patch file if called with ~preprocess:false [#5892 @kit-ty-kate]
  • OpamSystem.patch: now returns exn option instead of exn option OpamProcess.job and no longer calls the system GNU Patch [#5892 @kit-ty-kate]
  • OpamSystem.remove_dir: do not fail with an exception when directory is a symbolic link [#6276 @btjorge @rjbou - fix #6275]
  • OpamSystem, OpamFilename: add with_tmp_file and with_tmp_file_job function, that create a file name in temporary directory and removes it at the end of the call [#6036 @rjbou]

Following a post on discuss.ocaml.org, there has been a new release of ocurrent/ocaml-version that moves the minimum version of OCaml, considered as recent, from 4.02 to 4.08.

let recent = [ v4_08; v4_09; v4_10; v4_11; v4_12; v4_13; v4_14; v5_0; v5_1; v5_2; v5_3 ]

This change has far reaching side effects as OCaml-CI, opam-repo-ci, Docker base image builder among other things, use this to determine the set of versions of OCaml to test against. As these services are updated, testing on the old releases will be removed.

You can comment on this post on discuss.ocaml.org!

On behalf of the odoc team, I’m thrilled the announce the release of odoc 3.0.0 beta 1!

This release has been cooking for a long time - it’s been more than a year since odoc 2.4 landed, and a huge amount of work has gone into this. Thanks to the many others who contributed, either by code or by comments: @juloo, @panglesd, @EmileTrotignon, @gpetiot, @trefis, @sabine, @dbuenzli, @yawaramin, and more.

With this release we’re including a driver that knows how to use all of the exciting new features of odoc. This driver has been used to create the docs site for the various odoc tools.

Here are a selected set of features:

  • Rendered source! Jump from any item in the documentation straight to its rendered source; no matter how much of OCaml’s complex module system you are using.
  • Search by type! Our detective sherlodoc will find your lost value given its type.
  • Convenient warnings! Warnings are now clearly visible and useful, no longer buried among your dependencies’ warnings.
  • Self host your documentation, but link to ocaml.org for your dependencies.
  • More sidebars! Odoc 3 features a global sidebar, allowing you to discover the most hidden corner of underground documentation.
  • Image support! This cutting-edge feature now allows you to add images to your documentation. Video and audio come for free.
  • Fully cross-package links! The OCaml docs are now a true spider web. Prepare to catch bugs, and eat them.
  • Hierarchical documentation pages! We use a modular language. We don’t want a flat namespace for pages.
  • The build dependencies are friendlier with incremental build systems, allowing better shared build caches.
  • Quality of life improvements! Many improvements have been piling up since we started odoc 3. For instance: Add clock emoji before @since tag (@yawaramin, #1089)!

More explanation of these features is available at the odoc site, where we have documentation for authors, for users of odoc_driver, a cheatsheet, and differences from ocamldoc.

How can you help?

We need your feedback, both as authors and as users of documentation! Try things out using the new driver:

$ opam install odoc-driver    # don't forget to `opam update`
$ odoc_driver <package list>  # For instance: `$ odoc_driver brr odoc`
$ $YOUR_BROWSER _html/index.html

Many of those features’ implementations are not set in stone, but first versions. Please leave comments, either in this thread or as issues in the repository.

So, navigate already written documentation, and update your own docs to use the new features!

See full backstage

Highlight

  • Hierarchical documentation (@jonludlam, @panglesd, @Julow)
    Pages can now be organized in a directory tree structure.
    Relative and absolute references are added:
    {!./other_page.label}, {!//other_page}.

  • Improved sidebar and breadcrumbs navigation (@panglesd, @gpetiot)
    The documentation pages and the libraries of the entire package are shown on
    the left sidebar.

  • Added support for images, videos, audio and other assets
    The syntax is {image!/reference/to/asset} or {image:URL} for images.
    The syntax for {video...} and {audio...} is the same.
    (@panglesd, @EmileTrotignon, #1170, #1171, #1184, #1185)

  • Search using Sherlodoc (@panglesd, @EmileTrotignon, @Julow)
    A new search bar that supports full-text and type-based search.

Added

  • Experimental driver (@jonludlam, @panglesd)
    The driver builds the documentation for a collection of Opam packages using
    the newer Odoc features. It supports linking external packages to ocaml.org
    and markdown files.
    This is experimental and will break in the future.

  • Cross-package references (@panglesd, @Julow)
    Pages and modules from other packages can be referenced:
    {!/otherpackage/page}, {!/otherpackage/Module.t}.

  • Option to remap links to other packages to ocaml.org or other site.
    See the --remap option of the driver or the --remap-file option of odoc html-generate.
    (@jonludlam, #1189, #1248)

  • Option to compute occurrences of use of each identifiers
    The commands aggregate-occurrences and count-occurrences are added.
    (@panglesd, #976, #1076, #1206)

  • Added the odoc classify command (@jonludlam, #1121)
    Helps driver detecting which modules belong to which libraries.

  • Added --suppress-warnings to the CLI to remove warnings from a unit, even
    if they end up being raised in another unit through expansion
    (@jonludlam, #1260)

  • Add clock emoji before @since tag (@yawaramin, #1089)

  • Navigation for the search bar : use '/' to enter search, up and down arrows to
    select a result, and enter to follow the selected link. (@EmileTrotignon, #1088)

  • Fix a big gap between the preamble and the content of a page (@EmileTrotignon, #1147)

  • Add a marshalled search index consumable by sherlodoc (@EmileTrotignon, @panglesd, #1084)

  • Allow referencing of polymorphic constructors in polymorphic variant type
    aliases (@panglesd, #1115)

  • Added a home icon in the breacrumbs (@panglesd, #1251)
    It can be disabled with a CLI option.

  • Add a frontmatter syntax for mld pages (@panglesd, #1187, #1193, #1243, #1246, #1251)
    Allows to specify the title of a page, the order of sub-pages and other
    behaviors in the sidebar.

  • Added odoc-md to process standalone Markdown pages (@jonludlam, #1234)

Changed

  • The command line interface changed to support the new features.

    • Packages and libraries: odoc link must now be aware of packages and
      libraries with the -L libname:path and -P pkgname:path options. The
      module search path should still be passed with the -I option.
      The current package should be specified with --current-package=pkgname.
    • Hierarchy: odoc compile now outputs .odoc in the directory tree
      specified with --output-dir=DIR and the parent identifier must be
      specified with --parent-id=PARENT.
      The option --source-parent-file is removed.
    • Source code: Implementations are compiled with compile-impl instead of
      with compile. The options --cmt=.. and --source-name=.. are removed.
      Source code pages are generated with html-generate-source.
    • Assets: The commands compile-asset, html-generate-asset are added.
      The option html-generate --asset is removed.
    • Sidebar: The index is built using compile-index. The sidebar data is
      extracted from the index with sidebar-generate and passed to
      html-generate --sidebar=...
  • The syntax for @tag is now delimited (@panglesd, #1239)
    A @tag can now be followed by a paragraph or other elements.

  • Updated colors for code fragments (@EmileTrotignon, #1023)

  • Fixed complexity of looking up .odoc files (@panglesd, #1075)

  • Normalize whitespaces in codespans (@gpetiot, #1085)
    A newline followed by any whitespaces is normalized as one space character.

  • Reduce size of Odoc_html_frontend when compiled to javascript
    (@EmileTrotignon, #1072)

  • Overhaul of module-type-of expansions and shadowing code (@jonludlam, #1081)

  • Output file paths and labels in the man and latex backends changed to avoid
    name clashes (@Julow, #1191)

Fixed

  • Fix variant constructors being hidden if they contain hidden types
    (@jonludlam, #1105)
  • Fix rare assertion failure due to optional parameters
    (@jonludlam, #1272, issue #1001)
  • Fix resolution of module synopses in {!modules} lists that require --open
    (@jonludlam, #1104}
  • Fix top comment not being taken from includes often enough (@panglesd, #1117)
  • Fixed 404 links from search results (@panglesd, #1108)
  • Fixed title content not being picked up across pages when rendering references
    (#1116, @panglesd)
  • Fix wrong links to standalone comments in search results (#1118, @panglesd)
  • Remove duplicated or unwanted comments with inline includes (@Julow, #1133)
  • Fix bug where source rendering would cause odoc to fail completely if it
    encounters invalid syntax (@jonludlam #1208)
  • Add missing parentheses in 'val (let*) : ...' (@Julow, #1268)
  • Fix syntax highlighting not working for very large files
    (@jonludlam, @Julow, #1277)

The release of OCaml 5.3.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 second beta, this release candidate contains a regression fix in the type system (some type expressions were not generalized when they ought to be), one fix for the new check for dependency order at link time, and a manual update.

The full change log for OCaml 5.3.0 is available on GitHub. A short summary of the changes since the second 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.3.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.3.0~rc1+options <option_list>

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

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

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

See full backstage

Changes since the second beta

Type system

  • #13690: some type expressions were incorrectly not generalized (because they were assigned to the wrong level pool)

Documentation

  • #13666: Rewrite parts of the example code around nested lists in Chapter 6 (Polymorphism and its limitations -> Polymorphic recursion) giving the "depth" function [in the non-polymorphically-recursive part of the example] a much more sensible behavior; also fix a typo and some formatting. (Frank Steffahn, review by Florian Angeletti)

Compiler user-interface and warnings:

  • #12084, +#13669, +#13673: Check link order when creating archive and when using ocamlopt.

One month after the release of the first beta for OCaml 5.3.0, we are releasing a second and hopefully last beta release for OCaml 5.3.0 .

The most notable changes for this second beta are probably a handful of type system bugfixes. In particular, those fixes revert a change of behaviour in the first beta when pattern matching GADTs with non-injective type parameters.

We also have a C++ header compatibility fix and the restoration of some configuration variable in Makefiles for the sake of backward compatibility.

Overall, the release is converging and we are expecting to have a first release candidate around the middle of December. The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.3.0 meta-issue.

Meanwhile, the second beta release of OCaml 5.3.0 is here to help you update your software and libraries ahead of the release (see below for the installation instructions).

The full release is expected before the end of December.

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

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.3.0 is available on GitHub.


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.3.0~beta2

The source code for the beta is also available at these addresses:

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.3.0~beta2+options <option_list>

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

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

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

See full backstage

Changes Since The First Beta

Type system fixes

  • #13501: Regression on mutually recursive types caused by #12180. Resuscitate Typedecl.update_type. (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard Eisenberg and Gabriel Scherer)

  • #13495, #13514: Fix typechecker crash while typing objects (Jacques Garrigue, report by Nicolás Ojeda Bär, review by Nicolas Ojeda Bär, Gabriel Scherer, Stephen Dolan, Florian Angeletti)

  • #13598: Falsely triggered warning 56 [unreachable-case] This was caused by unproper protection of the retyping function. (Jacques Garrigue, report by Tõivo Leedjärv, review by Florian Angeletti)

Configuration fixes

  • (breaking change) #12578, #12589, #13322, +#13519: Use configured CFLAGS and CPPFLAGS only during the build of the compiler itself. Do not use them when compiling third-party C sources through the compiler. Flags for compiling third-party C sources can still be specified at configure time in the COMPILER_{BYTECODE,NATIVE}_{CFLAGS,CPPFLAGS} configuration variables. (Sébastien Hinderer, report by William Hu, review by David Allsopp)

C++ header compatibility

  • #13541, #13591: Fix headers for C++ inclusion. (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix)

Compiler library bug fix

  • #13603, #13604: fix source printing in the presence of the escaped raw identifier \#mod. (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer)

Discuss this post on Discuss!

Dune can install and run developer tools in the context of a project. This feature is available in the Dune Developer Preview and in the upcoming release of Dune 3.17. As with all of Dune's package management features, consider this feature to be unstable as its UI and semantics may change without notice.

The currently supported tools are ocamllsp and ocamlformat. Dune has a new command dune tools exec <TOOL> -- [ARGS]... which downloads and installs the given tool, and then runs it with the given arguments (note the -- which separates arguments to dune from arguments to the tool). Tools are installed locally to the project, in its _build directory, which makes it easy to use different versions of a tool in different projects. An unfortunate consequence of installing tools into _build is that for the time being all tools are uninstalled whenever dune clean is run.

Let's see it in action:

$ dune tools exec ocamlformat -- --version
Solution for dev-tools.locks/ocamlformat:
- ocamlformat.0.26.2+binary-ocaml-5.2.0-built-2024-11-07.0-x86_64-unknown-linux-musl
    Building ocamlformat.0.26.2+binary-ocaml-5.2.0-built-2024-11-07.0-x86_64-unknown-linux-musl
     Running 'ocamlformat --version'
0.26.2

Precompiled Binaries

Note that in the example above, Dune's package solver chose to install version 0.26.2+binary-ocaml-5.2.0-built-2024-11-07.0-x86_64-unknown-linux-musl of ocamlformat. This packages comes from a new repository of binary packages containing pre-built executables for a select few Opam packages. Dune will search this repository in addition to the default repositories when solving packages for tools only (if a project has ocamlformat in its dependencies, the binary repository won't be searched while solving the project's dependencies).

The goal of the binary repository is to reduce the time it takes to get started working on a new project. Without it, Dune would need to build ocamlformat from source along with all of its dependencies, which can take several minutes.

For now only a small number of package versions are contained in the binary repository. To demonstrate, here's what happens if we run dune tools exec ocamlformat in a project with version=0.26.1 in its .ocamlformat file:

 $ dune tools exec ocamlformat -- --version
Solution for dev-tools.locks/ocamlformat:
- astring.0.8.5
- base.v0.17.1
- base-bytes.base
- base-unix.base
- camlp-streams.5.0.1
- cmdliner.1.3.0
...
- ocamlformat.0.26.1
...
    Building base-unix.base
    Building ocaml-base-compiler.5.1.1
    Building ocaml-config.3
    Building ocaml.5.1.1
    Building seq.base
    Building cmdliner.1.3.0
...
    Building ocamlformat.0.26.1
     Running 'ocamlformat --version'
0.26.1

Dune parses .ocamlformat to determine which version of ocamlformat to install, and 0.26.1 is not in the binary repo so it needed to be built from source.

If your project requires a version of a package not available in the binary repository, or you're on an operating system or architecture for which no binary version of a package exists, the package will be built from source instead. Currently the binary repository contains binaries of ocamlformat.0.26.2, ocaml-lsp-server.1.18.0 and ocaml-lsp-server.1.19.0 for x86_64-unknown-linux-musl, x86_64-apple-darwin and aarch64-apple-darwin.

Note that Linux binaries are statically linked with muslc so they should work on all distros regardless of dynamic linker.

Running ocamllsp

The program ocamllsp from the package ocaml-lsp-server analyzes OCaml code and sends information to text editors using the Language Server Protocol. The tool is crucial to OCaml's editor integration and it has a couple of quirks that are worth mentioning here.

TL;DR: Install Dune with the install script on the Developer Preview page and you'll get an ocamllsp shell script that will install and run the correct version of ocamllsp for your project.

Firstly the ocamllsp executable can only analyze code that has been compiled with the same version of the OCaml compiler as was used to compile the ocamllsp executable itself. Different versions of the ocaml-lsp-server package are incompatible with some versions of the OCaml compiler (e.g. ocaml-lsp-server.1.19.0 must be built with at least 5.2.0 of the compiler). This means that when Dune is choosing which version of ocaml-lsp-server to install it needs to know which version of the compiler your project is using. This is only known after the project has been locked (by running dune pkg lock), so Dune will refuse to install ocamllsp in a project that doesn't have a lock directory or for a project that doesn't depend on the OCaml compiler.

$ dune tools exec ocamllsp
Error: Unable to load the lockdir for the default build context.
Hint: Try running 'dune pkg lock'

The ocaml-lsp-server packages in the binary repository contain metadata to ensure that the ocamllsp executable that gets installed was built with the same version of the compiler as your project. For example the ocaml-lsp-server package built with ocaml.5.2.0 contains this line:

conflicts: "ocaml" {!= "5.2.0"}

This prevents it from being chosen if the project depends on any version of the compiler other than 5.2.0.

Another quirk is that ocamllsp will try to invoke the binaries ocamlformat and ocamlformat-rpc, both found in the ocamlformat package. The ocaml-lsp-server package doesn't depend on ocamlformat as the specific version of ocamlformat needed by a project is implied by the project's .ocamlformat file, which package managers don't consider when solving dependencies. This means that in general (whether using Dune or Opam for package management) it's up to the user to make sure that the correct version of ocamlformat is installed in order to use the formatting features of ocamllsp.

Otherwise expect this error in your editor:

Unable to find 'ocamlformat-rpc' binary. Types on hover may not be well-formatted. You need to install either 'ocamlformat' of version > 0.21.0 or, otherwise, 'ocamlformat-rpc' package.

Even if ocamllsp and ocamlformat are both installed by Dune, if you run dune tools exec ocamllsp you will find that ocamllsp still can't find the ocamlformat or ocamlformat-rpc executables. This is because unlike Opam, Dune does not install tools into your $PATH, and for the sake of simplicity, the dune tools exec <TOOL> command does not modify the environment of the tool it launches. This can be fixed by adding _build/_private/default/.dev-tool/ocamlformat/ocamlformat/target/bin (the directory containing ocamlformat and ocamlformat-rpc when ocamlformat is installed by dune) to the start of your $PATH variable before running dune tools exec ocamllsp. For example starting ocamllsp with the following shell script:

OCAMLFORMAT_TARGET="_build/_private/default/.dev-tool/ocamlformat/ocamlformat/target"

if [ ! -f $OCAMLFORMAT_TARGET/cookie ]; then
    # Make sure that the ocamlformat dev tool is installed as it's needed by
    # ocamllsp. There's currently no command that just installs ocamlformat so
    # we need to run it and ignore the result.
    dune tools exec ocamlformat -- --help > /dev/null
fi

# Add ocamlformat to the environment in which ocamllsp runs so ocamllsp can invoke ocamlformat.
export PATH="$PWD/$OCAMLFORMAT_TARGET/bin:$PATH"

# Build and run ocamllsp.
dune tools exec ocamllsp -- "$@"

Of course, it's rare to manually start ocamllsp directly from your terminal. It's normally launched by text editors. It would be impractical to configure your text editor to modify $PATH and run a custom command to start ocamllsp via Dune, and doing so would make it impossible to edit any project that doesn't use Dune for package management. Instead, the Dune Developer Preview ships with a shell script which installs ocamlformat and adds its bin directory to $PATH before launching dune tools exec ocamllsp. The script is simply named ocamllsp, and the Dune Developer Preview install script adds it to ~/.dune/bin which should already be in your $PATH if you're using the Developer Preview. The ocamllsp script also attempts to fall back to an Opam-managed installation of ocamllsp if it doesn't detect a Dune lockdir so the same script should work for non-Dune projects. Because the script is named the same as the ocamllsp executable, most editors don't require special configuration to run it. See the "Editor Configuration" section of the Dune Developer Preview page for more information about setting up your editor.

Some parts of the ocamllsp shell script may eventually make their way into Dune itself, but for the time being the shell script is the recommended way to launch ocamllsp for users of the Dune Developer Preview. The net result is that as long as your project has a lockfile, the first time you edit some OCaml code in the project Dune will download and run the appropriate version of ocamllsp.

The release of OCaml version 5.2.1 is imminent.

OCaml 5.2.1 is a collection of safe but import runtime time bug fixes backported from the 5.3 branch of OCaml. The full list of bug fixes is available above.

In order to ensure that the future release works as expected, we are planning to test a release candidate during the upcoming week.

If you find any bugs, please report them here on GitHub.


Installation Instructions

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

opam update
opam switch create 5.2.1~rc1

The source code for the release candidate is 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.2.1~rc1+options <option_list>

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

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

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

See full backstage

Changes Since OCaml 5.2.0

Runtime System:

  • #13207: Be sure to reload the register caching the exception handler in caml_c_call and caml_c_call_stack_args, as its value may have been changed if the OCaml stack is expanded during a callback. (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and Xavier Leroy)

  • #13252: Rework register assignment in the interpreter code on m68k on Linux, due to the %a5 register being used by GLIBC. (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and Xavier Leroy)

  • #13268: Fix a call to test in configure.ac that was causing errors when LDFLAGS contains several words. (Stéphane Glondu, review by Miod Vallat)

  • #13234, #13267: Open runtime events file in read-write mode on ARMel (ARMv5) systems due to atomic operations limitations on that platform. (Stéphane Glondu, review by Miod Vallat and Vincent Laviron)

  • #13188: fix races in the FFI code coming from the use of Int_val(...) on rooted values inside blocking questions / without the runtime lock. (Calling Int_val(...) on non-rooted immediates is fine, but any access to rooted values must be done outside blocking sections / with the runtime lock.) (Etienne Millon, review by Gabriel Scherer, Jan Midtgaard, Olivier Nicole)

  • #13318: Fix regression in GC alarms, and fix them for Flambda. (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by Vincent Laviron and Gabriel Scherer)

  • #13140: POWER back-end: fix issue with call to caml_call_realloc_stack from a DLL (Xavier Leroy, review by Miod Vallat)

  • #13370: Fix a low-probability crash when calling Gc.counters. (Demi Marie Obenour, review by Gabriel Scherer)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

One month and half after the release of the first alpha for OCaml 5.3.0, the release of OCaml 5.3.0 is drawing near.

The internal API of the compiler libraries has been frozen, and most core developer tools support (or will support soon) the new version of the compiler.

We have thus released a first beta version of OCaml 5.3.0 to help you update your software and libraries ahead of the release (see below for the installation instructions). More information about the whole release process is now available in the compiler repository.

Compared to the first alpha release, this beta contains a few runtime or typechecker fixes, a handful of fixes for the runtime event library and other miscellaneous fixes.

Exceptionally, this beta release also introduces a new flag -keywords for the compiler. This backward compatibility flag aims to help compiling old code that are using effect as a normal identifier, now that effect is a keyword in the new effect handler syntax.

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.3.0 meta-issue.

The full release is expected in the end of November or beginning of December, see the new prospective calendar for more information.

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

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.3.0 is available on GitHub.


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.3.0~beta1

The source code for the beta is also available at these addresses:

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.3.0~beta1+options <option_list>

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

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

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

See full backstage

Runtime fixes

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

Typechecker fixes

  • #13579, #13583: Unsoundness involving non-injective types + gadts (Jacques Garrigue, report by @v-gb, review by Richard Eisenberg and Florian Angeletti)

  • #13388, #13540: raises an error message (and not an internal compiler error) when two local substitutions are incompatible (for instance module type S:=sig end type t:=(module S)) (Florian Angeletti, report by Nailen Matschke, review by Gabriel Scherer, and Leo White)

Compiler flag

  • #13471: add -keywords <version?+list> flag to define the list of keywords recognized by the lexer, for instance -keywords 5.2 disable the effect keyword. (Florian Angeletti, review by Gabriel Scherer)

Runtime event library fixes

  • #13419: Fix memory bugs in runtime events system. (B. Szilvasy and Nick Barnes, review by Miod Vallat, Nick Barnes, Tim McGilchrist, and Gabriel Scherer)

  • #13407: Add Runtime_events.EV_EMPTY_MINOR (Thomas Leonard)

  • #13522: Confirm runtime events ring is still active after callback. (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat)

  • #13529: Do not write to event ring after going out of stw participant set. (KC Sivaramakrishnan, review by Sadiq Jaffer)

Documentation

  • #13424: Fix Gc.quick_stat documentation to clarify that returned fields live_words, live_blocks, free_words, and fragments are not zero. (Jan Midtgaard, review by Damien Doligez and KC Sivaramakrishnan)

  • #13440: Update documentation of Gc.{control,get,set} to reflect fields not currently supported on OCaml 5. (Jan Midtgaard, review by Gabriel Scherer)

  • #13469, #13474, #13535: Document that [Hashtbl.create n] creates a hash table with a default minimal size, even if [n] is very small or negative. (Antonin Décimo, Nick Bares, report by Nikolaus Huber and Jan Midtgaard, review by Florian Angeletti, Anil Madhavapeddy, Gabriel Scherer, and Miod Vallat)

Standard library internal fix

  • #13543: Remove some String-Bytes conversion from the stdlib to behave better with js_of_ocaml (Hugo Heuzard, review by Gabriel Scherer)

Toplevel fix

  • #13263, #13560: fix printing true and false in toplevel and error messages (no more unexpected #true) (Florian Angeletti, report by Samuel Vivien, review by Gabriel Scherer)

Compiler internals

  • #13391, #13551: fix a printing bug with -dsource when using raw literal inside a locally abstract type constraint (i.e. let f: type \#for. ... ) (Florian Angeletti, report by Nick Roberts, review by Richard Eisenberg)

Feedback on this post is welcomed on Discuss!

We're happy to announce the first and hopefully only release candidate of opam 2.3.0.

This version does not have any significant change compared to the previous 2.3.0~beta2 release and we hope the final release to also have no significant change. Regardless, we invite users to test this version to make sure there isn't any regressions.

Unless a regression is spotted or another problem arises, we hope to have the final release of 2.3.0 out on the 12th of November.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~rc1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~rc1"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

Discuss this post on Discuss!

Support for dune shell completions for bash and zsh has just landed in the Dune Developer Preview!

Running the installer adds a snippet to your shell config (e.g. ~/.bashrc) that installs a completion handler for dune. The completion script was taken from here, and that page has some information about how the script was generated. Once it's installed the completions will work any time dune is typed at the start of a command, so you can still use the completions when running a version of Dune installed with Opam or your system package manager after installing the Dune Developer Preview.

Currently only command completions are supported. So you can run:

$ dune c<TAB>
cache  clean  coq

...or:

$ dune build -<TAB>
--action-stderr-on-success
--action-stdout-on-success
--always-show-command-line
--auto-promote
--build-dir
--build-info
--cache
...

But if you run dune build <TAB> then it will still suggest local files rather than build targets.

Try it out!

Getting started is easy:

$ curl -fsSL https://get.dune.build/install | sh
$ source ~/.bashrc  # or: source ~/.zshrc
$ dune <TAB>
build
cache
clean
coq
describe
diagnostics
exec
...

Feedback on this post is welcomed on Discuss!

We're happy to announce the second beta release of opam 2.3.0.

As this version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

Compared to the previous 2.3.0~beta1 release, the main change is:

  • Fix a regression in the detection of the current terminal size that leads to opam output that tries to fit itself into 80 columns regardless of the current terminal size (#6243).

  • A NetBSD/x86_64 pre-built release binary is now available

You can view the full list of changes, including API changes, in the release note.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~beta2"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~beta2"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

Feedback on this post is welcome on Discuss!

We're happy to announce the first beta release of opam 2.3.0. Compared to the previous 2.3.0~alpha1 release, you can view the full list of changes in the release note.

This version is a beta, so we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

  • Fix an opam 2.1 regression where the initial pin of a local VCS directory would store untracked and ignored files. Those files would usually be cleaned before building the package; however, Git submodules would not be cleaned and would cause issues when paired with the new behaviour added in 2.3.0~alpha1, which makes an opam error when Git submodules fail to update (it was previously a warning). (#5809)

  • Fix a regression which would make opam crash on platforms where getconf LONG_BIT is not available (e.g., OpenBSD). (#6215)

  • Fix the installed packages internal cache, which was storing the wrong version of the opam file after a build failure. This could be triggered easily for users with custom repositories with non-populated extra-files. (#6213)

  • Fix a regression in lint W59 with local URLs that are not archives. (#6218)

  • Fix the compilation of opam on Windows with OCaml >= 5.0 (again)

  • Several improvements to the prebuilt release binaries were made:

    • The Linux binaries are now built on Alpine 3.20
    • The FreeBSD binary is now built on FreeBSD 14.1
    • The OpenBSD binary is now built on OpenBSD 7.6 and loses support for OpenBSD 7.5 and older
    • A Linux/riscv64 binary is now available

API changes are denoted in the release note linked above. This release also includes a couple of PRs improving and extending the tests.

Try It!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~beta1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~beta1"

or download manually from the GitHub "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

Tarides' OCaml Infrastructure team has been hard at work over the last few months, focusing on improving the stability, reliability, and user experience of the OCaml ecosystem's core infrastructure. We are preparing for more substantive changes to come. We will have more fruit from this work to share soon, but updates on our efforts are overdue and we wanted to get you all caught up.

Platform Support

We've expanded and updated our platform support to keep pace with the evolving OCaml ecosystem:

  • As part of the compiler release readiness, we've added support for OCaml 5.2 and the upcoming 5.3, currently in alpha.
  • We're now publishing Windows Server 2022 Docker images to the OCaml Dockerhub. See for instance windows-server-msvc-ltsc2022-ocaml-4.14
  • Dropped support for the post-LTS distro versions Debian 10 and 11, focusing our resources on the OCaml compiler's Tier 1 platform.

These updates ensure that our systems continue to support OCaml developers on a broad range of systems, in particular by testing package publication to the opam repository and publishing Docker images.

Opam Repository Publishing Experience

We've made improvements to enhance the experience of publishing packages to the opam repository:

  • Implemented a linting check for package maintainer email addresses, ensuring package maintainers can be reliably contacted when needed.
  • Mitigated solver timeout errors in the opam repo CI system, reducing frustrating delays in the package publishing process.
  • Fixed an uncaught exception that sometimes occurred during linting checks in the opam repo CI.
  • Improved error reporting and added instructions for running lint checks locally, making it easier for package authors to identify and resolve issues before submitting to the repository.
  • We are generating documentation of the platforms under test in opam CI, allowing package authors a clear overview of the extensive build matrix we are providing.

We hope these changes will make package publication experience smoother. We're committed to improving the experience for newcomers and existing repository contributors alike, stay tuned for more improvements!

Security and Reliability

Maintaining the security and reliability of the OCaml infrastructure remains a top priority:

  • Updated our systems to address CVE-2024-6387.
  • We maintained 99.9% availability for the opam repo CI over the last two months, providing a stable and reliable service for the OCaml community.

Forging Ahead

Much has been done but much more is in the works! Expect updates more regularly going forward, and don't hesitate to reach out on ocaml/infrastructure/issues or discuss.ocaml.org if you have questions, requests, or ideas!

Related Changes

  • Added continuous deployment for service configuration (by @mtelvers, https://github.com/ocurrent/ocurrent-configurator)
  • Implemented linting for package maintainer email addresses (by @punchagan, https://github.com/ocurrent/opam-ci-check/pull/30)
  • Mitigated solver timeout errors in opam repo CI (by @mtelvers and @shonfeder, https://github.com/ocaml/infrastructure/issues/147)
  • Fixed uncaught exception in opam repo CI linting checks (by @shonfeder, https://github.com/ocurrent/opam-repo-ci/pull/341)
  • Updated systems to address CVE-2024-6387 (by @mtelvers, https://github.com/ocaml/infrastructure/issues/140)
  • Added support for OCaml 5.2 and 5.3 (by @mtelvers, https://github.com/ocurrent/opam-repo-ci/issues/268 and https://github.com/ocurrent/opam-repo-ci/issues/363)
  • Improved Windows support (by @mtelvers, https://github.com/ocurrent/docker-base-images/issues/241)
  • Added support for GCC 14 (by @mtelvers, https://github.com/ocurrent/docker-base-images/issues/279)
  • Dropped support for Debian 10 and 11 (by @mtelvers and @shonfeder, https://github.com/ocurrent/ocaml-dockerfile/pull/220 and https://github.com/ocurrent/ocaml-dockerfile/pull/210)
  • Generated documentation of CI test platforms and deployed services (by @benmandrew, https://github.com/ocurrent/opam-repo-ci/blob/master/doc/platforms.md and https://github.com/ocurrent/ocurrent-deployer/blob/master/doc/services.md)
  • Improved error reporting and local lint check instructions in opam CI (by @punchagan, https://github.com/ocurrent/opam-repo-ci/issues/359 and https://github.com/ocurrent/opam-repo-ci/issues/360)

Hello folks! 👋

We'd like to welcome everyone to try and play with the Dune Developer Preview! 🎉

This experimental nightly release of dune includes a lot of improvements, including the much expected package management features, and it can be installed from that website or by using the new installation script:

$ curl -fsSL https://get.dune.build/install | bash

In a few seconds you should be ready to OCaml by calling dune:

Installing the Dune Developer Preview|690x442

You can also watch and share this demo on X and Mastodon.

Please try it out and let us know what you think 🙏

📅 You can book a feedback call with us here

📝 You can submit feedback using this form

🐛 You can submit issues to Github on ocaml/dune

Changes since last update

The Dune shared cache has been enabled by default. We're starting off by caching all downloads and dependencies.

We have improved support for dev tools. We're working to streamline this but in the latest binary you can:

  • Configure your LSP (in Neovim, Vim, Emacs, etc) to call dune tools exec ocamllsp to get LSP support for your projects out of the box – this may take a little bit the first time it builds the LSP for a compiler version, but it's pretty much instant afterwards.

  • Call dune fmt to get your project formatted – remember to add an .ocamlformat file if you don't have one yet. An empty one is enough.

  • Call dune ocaml doc to get documentation built

What's next?

We're looking forward to streamlining the DX, working on better dependency locks, and looking into supporting Windows.

In particular, we're considering work on a few things:

  • dune create <repo> – to let the community create templates that can be easily used from within dune
  • dune pkg fetch – to prefetch packages and prepare a repository for working in offline mode
  • dune build @deps - to build all dependencies, useful for staged builds in Dockerfiles
  • dune pkg add <name> - to make adding packages straightforward
  • a short-hand syntax for pins on github
  • and more!

If you've got any ideas, we'd love to hear them, so please open a feature request on Github 🙏

Other updates

FunOCaml Presentation

At FunOCaml we had a last-minute opportunity to present the work being done on Dune and we used it to introduce the Developer Preview to the community, and even tested Package Management live with suggestions from the audience (thanks @anmonteiro and Paul-Elliot for participating!) – you can watch it on Twitch.

New design

We're working with @Claire_Vandenberghe on redesigning the Developer Preview website so that it'd feel like a seamless extension of OCaml.org – in this current iteration we've made it easier to get started and we're putting the FAQ front and center.

We'll be iterating on this design in the coming weeks until it fits perfectly within the OCaml.org design system 🎨

You can check the new website here: https://preview.dune.build

Upcoming Blog posts

In the near future we'll be publishing blog posts about the Developer Preview and Package Management, which we're working on with @professor.rose 👏

Four months after the release of OCaml 5.2.0, the set of new features for the future version 5.3.0 of OCaml has been frozen. We are thus happy to announce the first alpha release for OCaml 5.3.0.

This alpha version is here to help fellow hackers join us early in our bug hunting and opam ecosystem fixing fun (see below for the installation instructions). More information about the whole release process is now available in the compiler repository, and we will try to propagate this information to ocaml.org shortly.

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.3.0 meta-issue.

The full release is expected around November, see the new prospective calendar for more information.

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

If you are interested in the ongoing list of new features and bug fixes, the updated change log for OCaml 5.3.0 is available on GitHub.


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.3.0~alpha1

The source code for the alpha is also available at these addresses:

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.3.0~alpha1+options <option_list>

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

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

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

Feedback on this post is welcomed on Discuss!

As mentioned in our talk at the OCaml Workshop 2024, we decided to switch to a time-based release cycle (every 6 months), starting with opam 2.3.

As promised, we are happy to announce the first alpha release of opam 2.3.0. You can view the full list of changes in the release note.

This version is an alpha, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Major breaking change

When loading a repository, opam now ignores files in packages' files/ directories which aren't listed in the extra-files field of the opam file. This was done to simplify the opam specification where we hope the opam file to be the only thing that you have to look at when reading a package specification. The optionality of the extra-files: field goes against that principle. This change also reduces the surface area for potential file corruption as it ensures that extra-files are checked against their checksums.

This is a breaking change and means that if you are using the files/ directory without the extra-files: field, you need to make sure that all files in that directory are listed in the extra-files field. Once done, the resulting opam file is backward-compatible and you don't need to worry about anything else.

If you have an opam repository, you should make sure all files are listed so every packages continues to work without any issue, which can be done automatically using the opam admin update-extrafiles command.

Major changes

  • Packages requiring an unsupported version of opam are now marked unavailable, instead of causing a repository error. This means an opam repository can now allow smoother upgrade in the future where some packages can require a newer version of opam without having to fork the repository to upgrade every package to that version as was done for the upgrade from opam 1.2 to 2.0

  • Add a new opam list --latests-only option to list only the latest versions of packages. Note that this option is respects the order options were given on the command line. For example: --available --latests-only will first list all the available packages, then choose only the latest packages in that set; while --latests-only --available will first list all the latest packages, then only show the ones that are available in that set

  • Fix and improve opam install --check, which now checks if the whole dependency tree of the package is installed instead of only the root dependencies

  • Add a new --verbose-on option to enable verbose output for specified package names. Thanks to @desumn for this contribution

  • Add a new opam switch import --deps-only option to install only the dependencies of the root packages listed in the opam switch export file

  • opam switch list-available will now not display compilers flagged with avoid-version/deprecated unless --all is given, meaning that the "trunk" build of OCaml no longer appears to be the latest version

  • opam switch create --repos now accepts git URLs suffixed with .git instead of requiring the git+https:// protocol prefix. This is consistant with other commands such as opam repository add. Thanks to @Keryan-dev for this contribution

  • opam switch set-invariant now displays the switch invariant using the same syntax as the --invariant flag

  • The builtin-0install solver was improved and should now be capable of being your default solver instead of builtin-mccs+glpk. It was previously mostly only suited for automated tasks such as Continuous Integration. If you wish to give it a try, simply call opam option solver=builtin-0install

  • Most of the unhelpful conflict messages were fixed

  • Fix the value of the arch variable when the current OS is 32bit on a 64bit machine (e.g. Raspberry Pi OS)

  • opam now fails when git submodules fail to update instead of ignoring the error and just showing a warning

  • opam's libraries now compile with OCaml >= 5.0 on Windows

Various performance and other improvements were made and bugs were fixed. API changes are denoted in the release note linked above. This release also includes a handful of PRs improving the documentation and more two dozen PRs improving and extending the tests.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~alpha1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~alpha1"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

As we prepare for the public beta, we're ramping up the DX interviews and ensuring the first few users will have a fun, productive experience with the Developer Preview.

📥 If you signed up for the Dev Preview back in May, check your inbox for a link and instructions to schedule your DX interview with us.

Here's a sample video on (Mastodon or X) where you can see us building the Riot project on a machine that does not have OCaml installed. It is pretty neat!

Seriously, big shoutout to the Dune team at Tarides[0] and Jane Street[1] who have been doing a phenomenal job 👏 ✨ 🐫

So here's what getting started with OCaml looks like using the Dune Developer Preview as of today (August 19 2024):

  1. get dune from our binary distribution – we'll soon make this public!
  2. run dune pkg lock in your favorite project
  3. run dune build

That's it. No need to install anything else! Dune will see that lock file, fetch, and build all necessary dependencies.

🗺️ These are some strong steps towards the OCaml Platform vision for 2026 that we are actively working towards. If you have any thoughts or feedback please let us know!

There are more improvements coming that will help remove friction to get started and create a delightful experience. Both of these things we strongly believe will help onboard new users to the OCaml world.

Here's a few in the works:

  • Various DX improvements – from new outputs to simplified workflows, we want to make using Dune just delightful.

  • Bundled support for dev tools (OCamlFormat, odoc, LSP) – the default toolset will be available without any extra steps! Just call dune fmt and it works. No need to manually install anything else.

  • Automatic dependency locking – when building, and even in watch mode, Dune will lock your dependencies by default and keep the lock up to date.

  • Cross-project caching – by default we'll enable a local Dune cache across the system, so you never rebuild the same dependency, even across projects.

  • Signed binaries with certificates of origin – we care deeply about security and want to make sure that any binary we ship can be easily verified and tracked back to its sources.

Stay tuned! 👋

PS: here's a longer video on (Mastodon or X) showing you the setup for OCaml from zero, creating a new project, and adding a dependency, all within ~5 minutes

[0] @emillon @Leonidas @gridbugs @tmattio @maiste . Ambre Suhamy, Alpha Diallo [1] @rgrinberg

Feedback on this post is welcomed on Discuss!

We are very excited to announce the first (and hopefully only) release candidate for opam 2.2.0.

We've squashed a few more bugs and we consider this to be ready for the final release. You can view the full list of changes in the release note.

We invite users to test it one final time just in case there are any previously unnoticed bugs!

Changes

  • Fix opam upgrade wanting to keep rebuilding the compiler (as now it contains an x-env-path-rewrite field)
  • Provide defaults so opam init -y no longer asks questions on Windows
  • Fix OpamConsole.menu when there are more than 9 options (can happen on Windows)

A couple more improvements were made and bugs were fixed. The single API change is also denoted in the release note. This release also includes PRs extending the tests.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~rc1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features of opam 2.2!

Feedback on this post is welcomed on Discuss!

We are very pleased to announce the third and final beta release of opam 2.2.0.

We've done our best to polish everything and squash as many bugs as possible in order to be ready for the final release. You can view the full list of changes in the release note.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we near the stable release.

Changes

  • Greatly enhance the opam init user experience on Windows, and the number of recognised configurations
  • New option opam init --cygwin-extra-packages=CYGWIN_PKGS --cygwin-internal-install, to specify additional packages for the internal Cygwin installation
  • Redirect the opam root to C:\opamroot\opam-xxx when the opam root contains spaces on Windows
  • Out-of-the-box UTF-8 paged --help on Windows
  • Fix a performance regression when calling opam install --deps-only on an already installed package
  • Fix several edge cases related to environment reverting
  • Fixed some issues that could appear when upgrading from previous versions of opam
  • Fix various issues with opam tree --with-test
  • Fix parsing opam 2.1 switch import files containing extra-files
  • Fix download URLs containing invalid characters on Windows
  • Fix some failure cases when extracting tarballs which contain symlinks on Windows

Various other general and performance improvements were made and bugs were fixed. API changes are denoted in the release note. This release also includes PRs improving the documentation and improving and extending the tests.

Try it on Windows!

BEWARE: the command shown below is experimental, use caution and please do report any issues that you are experiencing. If you prefer to not use our experimental script, feel free to get the Windows binary directly from the Release Page and put it in your directory of choice instead.

Now that the Windows support was merged in opam-repository, testing is as simple as calling the following command from a PowerShell terminal:

Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/kit-ty-kate/opam/windows-installer/shell/install.ps1) }"

opening a new terminal, and a simple opam init will work out-of-the-box.

Try it on other platforms!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~beta3"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

The release of OCaml 5.2.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 second beta, this release contains one small compiler-libs printer fix and one configuration tweak.

The full change log for OCaml 5.2.0 is available on GitHub. A short summary of the changes since the second 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.2.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.2.0~rc1+options <option_list>

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

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

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

See full backstage

Changes since the second beta

  • #13130: Minor fixes to pprintast for raw identifiers and local module open syntax for types. (Chet Murthy, review by Gabriel Scherer)

  • #13100 Fix detection of zstd when compiling with musl-gcc (David Allsopp, review by Samuel Hym)

Last week, we merged an update to the compiler-libs "shape" API for querying definition information from the compiler.

Unfortunately, this small change of API breaks compatibility with at least odoc. Generally, we try to avoid this kind of changes during the beta releases of the compiler. However, after discussions we concluded that it will be easier on the long term to fix the API right now in order to avoid multiplying the number of supported versions of the shape API in the various OCaml developer tools .

We have thus released a second beta version of OCaml 5.2.0 to give the time to developer tools to update their 5.2.0 version ahead of the release (see below for the installation instructions).

Beyond this changes of API, the new beta contains three more bug fixes and three documentation updates, which is a good sign in term of stability.

As usual, you can follow the last remaining compatibility slags on the opam readiness for 5.2.0 meta-issue.

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

Currently, the release is planned for the beginning of May.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.2.0 is available on GitHub.


Installation Instructions

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

opam update
opam switch create 5.2.0~beta2

The source code for the beta is also available at these addresses:

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.2.0~beta2+options <option_list>

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

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

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

See full backstage

Compiler-libs API Changes

  • #13001: do not read_back entire shapes to get aliases' uids when building the usages index (Ulysse Gérard, review by Gabriel Scherer and Nathanaëlle Courant)

Bug Fixes

  • #13058: Add TSan instrumentation to caml_call_gc(), since it may raise exceptions. (Fabrice Buoro, Olivier Nicole, Gabriel Scherer and Miod Vallat)

  • #13079: Save and restore frame pointer across Iextcall on ARM64 (Tim McGilchrist, review by KC Sivaramakrishnan and Miod Vallat)

  • #13094: Fix undefined behavior of left-shifting a negative number. (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär)

Documentation Updates

  • #13078: update Format tutorial on structural boxes to mention alignment questions. (Edwin Török, review by Florian Angeletti)

  • #13092: document the existence of the [@@poll error] built-in attribute (Florian Angeletti, review by Gabriel Scherer)

  • #13066, update OCAMLRUNPARAM documentation for the stack size parameter l (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and Miod Vallat)

Feedback on this post is welcomed on Discuss!

We are indescribably thrilled to announce the second beta release of opam 2.2.0.

It contains everything required to be able to make opam-repository compatible with Windows, as well as a whole bunch of fixes. You can view the full list of changes in the release note.

We'll post another blog post very soon with more directions on how to test opam on Windows with this release.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

Windows support

This beta introduces a handful of changes necessary to be able to make the default opam-repository support Windows out of the box:

  • Add a new sys-ocaml-system init default global eval variable
  • Hijack the "%{var?string-if-true:string-if-false-or-undefined}%" syntax to support extending the variables of packages with + in their name (conf-c++ and conf-g++ already exist) using "%{?pgkname:var:}%"
  • Add winsymlinks:native to the CYGWIN environment variable when installing a package on Windows. In particular, this provides a workaround when extracting ocamlbuild's sources.
  • Internal Cygwin installation's bin directory is placed as far down PATH as is necessary not to shadow bash, tar, sort or git
  • Disable ACL in Cygwin internal install to avoid permission mismatch errors

We expect to be able to show the proposed changed to opam-repository very soon to take advantage of all these changes.

opam-repository scalability

The current draft resolution resulting from the discussion in ocaml/opam-repository#23789 about the scalability of opam-repository includes the removal of some packages. However currently, opam uses the patch system command to apply changes from a repository. The behaviour of that command is thus very important and it is a known behaviour for the macOS and BSDs patch command to not be able to delete files which leads to failures and inconsistencies for opam. Package managers on those platforms installing opam already make opam depend on GNU patch, however a certain number of people do not install opam via a system package manager (e.g. our own install script!) and end up using their system version of patch. This is in particular a problem on macOS as the name of the GNU patch command is not gpatch like on BSDs but simply patch when installed via Homebrew.

This issue is surprisingly tricky to fix, and after many trials and errors, we've decided to:

  • Warn if GNU patch is not detected when a patch is applied
  • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD
  • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch

These changes will make their way to the upcoming opam 2.1.6, in a few weeks.

Other noteworthy changes

  • Recommend enabling Developer Mode on Windows. This allows the creation of symlinks without requiring elevation. Longer-term, the aim is that we should never require Developer Mode, but at the moment more things work with it than without it!
  • Mark the internal Cygwin installation as recommended. Please don't try to maintain your own Cygwin install for use with opam unless you really know what you're doing!
  • Fix MSYS2 support. For 2.2.0, the focus has been on Cygwin, so configuring opam to use MSYS2 is quite manual. Please note that even if opam can use a MSYS2 installation, it is not yet officially supported and opam repository is not yet MSYS2 compatible. Use opam with MSYS2 only if you really really know what you're doing!
  • Fix issues when using fish
  • Improve the internal Cygwin installation during init on Windows
  • Unixify Windows paths in init shells scripts
  • Disable Software Heritage fallback by default as there currently no CI job in opam-repository to check validity of proposed swhid regarding release archive (neither publication tools support) and some concerns were raised regarding the degree of trust of the hashing method used by Software Heritage (sha1).
  • Make sure opam source --dev with git sources, clones the whole repository instead of using --depth=1
  • Sandbox: Mark the user temporary directory (as returned by getconf DARWIN_USER_TEMP_DIR) as writable when TMPDIR is not defined on macOS
  • Add Warning 69: Warn for new syntax when package name in variable in string interpolation contains several '+' (this is related to the "hijack" item above)
  • Add support for Wolfi OS, treat it like Alpine family as it also uses apk
  • Upgrade the vendored dune package to 3.14.2 to allow to compile opam when the environment contains unicode characters on Windows (in particular, this means opam now works if your username contains accented characters)
  • Upgrade other vendored packages (cmdliner 1.2.0, re 1.11.0, ocamlgraph 2.1.0, opam-file-format 2.1.6)

Various other general and performance improvements were made and bugs were fixed. API changes are denoted in the release note. This release also includes PRs improving the documentation and improving and extending the tests.

Windows Support

As we've said above we're writing a separate blog post to present how to test this new release of opam on Windows.

Stay tuned!

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~beta2"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

Nearly two months after the first alpha release, the release of OCaml 5.2.0 is drawing near.

We have thus released a first beta version of OCaml 5.2.0 to help you update your softwares and libraries ahead of the release (see below for the installation instructions).

Compared to the alpha release, this beta contains a majority of runtime system fixes, and a handful of other fixes across many subsystems.

Overall, the opam ecosystem looks in a good shape for the first beta release. Most core development tools support OCaml 5.2.0, and you can follow the last remaining wrinkles on the opam readiness for 5.2.0 meta-issue.

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

Currently, the release is planned for the end of April or the beginning of May.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.2.0 is available on GitHub.


Installation Instructions

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

opam update
opam switch create 5.2.0~beta1

The source code for the alpha is also available at these addresses:

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.2.0~beta1+options <option_list>

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

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

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

See full backstage

Runtime System Fixes

  • #12875, #12879, #12882: Execute preemptive systhread switching as a delayed pending action. This ensures that one can reason within the FFI that no mutation happens on the same domain when allocating on the OCaml heap from C, consistently with OCaml 4. This also fixes further bugs with the multicore systhreads implementation. (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark Shinwell, review by Nick Barnes and Stephen Dolan)

  • #12876: Port ThreadSanitizer support to Linux on POWER (Miod Vallat, review by Tim McGilchrist)

  • #12678, #12898: free channel buffers on close rather than on finalization (Damien Doligez, review by Jan Midtgaard and Gabriel Scherer, report by Jan Midtgaard)

  • #12915: Port ThreadSanitizer support to Linux on s390x (Miod Vallat, review by Tim McGilchrist)

  • #12914: Slightly change the s390x assembly dialect in order to build with Clang's integrated assembler. (Miod Vallat, review by Gabriel Scherer)

  • #12897: fix locking bugs in Runtime_events (Gabriel Scherer and Thomas Leonard, review by Olivier Nicole, Vincent Laviron and Damien Doligez, report by Thomas Leonard)

  • #12860: Fix an assertion that wasn't taking into account the possibility of an ephemeron pointing at static data. (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11040, #12894: Silence false data race observed between caml_shared_try_alloc and oldify. Introduces macros to call tsan annotations which help annotate a ``happens before'' relationship. (Hari Hara Naveen S and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12919: Fix register corruption in caml_callback2_asm on s390x. (Miod Vallat, review by Gabriel Scherer)

  • #12969: Fix a data race in caml_darken_cont (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

Standard Library Fix

  • #12677, #12889: make Domain.DLS thread-safe (Gabriel Scherer, review by Olivier Nicole and Damien Doligez, report by Vesa Karvonen)

Type System Fix

  • #12924, #12930: Rework package constraint checking to improve interaction with immediacy (Chris Casinghino and Florian Angeletti, review by Florian Angeletti and Richard Eisenberg)

Compiler User-Interface Fix

  • #12971, #12974: fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

Build System Fixes

  • #12198, #12321, #12586, #12616, #12706, +#13048: continue the merge of the sub-makefiles into the root Makefile started with #11243, #11248, #11268, #11420 and #11675. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #12768, +#13030: Detect mingw-w64 coupling with GCC or LLVM, detect clang-cl, and fix C compiler feature detection on macOS. (Antonin Décimo, review by Miod Vallat and Sébastien Hinderer)

  • #13019: Remove linking instructions for the Unix library from threads.cma (this was done for threads.cmxa in OCaml 3.11). Eliminates warnings from new lld when using threads.cma of duplicated libraries. (David Allsopp, review by Nicolás Ojeda Bär)

  • #12758, +#12998: Remove the Marshal.Compression flag to the Marshal.to_* functions. The compilers are still able to use ZSTD compression for compilation artefacts. This is a forward port and clean-up of the emergency fix that was introduced

Compiler Internals Fix

  • #12389, #12544, #12984, +#12987: centralize the handling of metadata for compilation units and artifacts in preparation for better unicode support for OCaml source files. (Florian Angeletti, review by Vincent Laviron and Gabriel Scherer)

We have the pleasure of celebrating the birthday of Grace Chisholm Young by announcing the release of OCaml version 4.14.2.

This release is a collection of safe bug fixes, cherry-picked from the OCaml 5 branch. If you are still using OCaml 4.14 and cannot yet upgrade to OCaml 5, this release is for you.

The 4.14 branch is expected to receive updates for at least one year, while the OCaml 5 branch is stabilising.

Thus don't hesitate to report any bugs on the OCaml issue tracker.

See the list of changes below for more details.


Installation Instructions

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

opam update
opam switch create 4.14.2

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

See full backstage

Changes in OCaml 4.14.2 (14 March 2024)

Runtime system:

  • #11764, #12577: Add prototypes to old-style C function definitions and declarations. (Antonin Décimo, review by Xavier Leroy and Nick Barnes)

  • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)

  • (breaking change) #10723: do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
  • #11332, #12702: make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

Build system:

  • #11590: Allow installing to a destination path containing spaces. (Élie Brami, review by Sébastien Hinderer and David Allsopp)

  • #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)

  • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)

Bug fixes:

  • #12061, #12063: don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)

  • #12878: fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)

  • #12971, #12974: fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)

  • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)

  • #11633, #11636: bugfix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)

  • #12636, #12646: More prudent reinitialization of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)

  • (breaking change) #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
  • #12958: Fix tail-modulo-cons compilation of try-with, && and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

  • #12116, #12993: explicitly build non PIE executables on x86 32bits architectures (Florian Angeletti, review by David Allsopp)

  • #13018: Don't pass duplicate libraries to the linker when compiling ocamlc.opt and when using systhreads (new versions of lld emit a warning). (David Allsopp, review by Nicolás Ojeda Bär)

The release of OCaml version 4.14.2 is imminent.

OCaml 4.14.2 is a new update to the stable 4.14 branch of OCaml. This new release backports many safe bug fixes from the OCaml 5 branch and fixes a handful of compatibility issues of OCaml 4.14.1 with newer operating system versions.

A full list of bug fixes is available below.

In order to ensure that the future release works as expected, we are planning to test a release candidate during the upcoming week.

If you find any bugs, please report them here on GitHub.


Installation Instructions

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

opam update
opam switch create 4.14.2~rc1

The source code for the release candidate is 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.4.14.2~rc1+options <option_list>

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

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

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

See full backstage

Changes Since OCaml 4.14.1

Runtime System:

  • #11764, #12577: Add prototypes to old-style C function definitions and declarations. (Antonin Décimo, review by Xavier Leroy and Nick Barnes)

  • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)

  • (breaking change) #10723: Do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
  • #11332, #12702: Make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

Build System:

  • #11590: Allow installing to a destination path containing spaces (Élie Brami, review by Sébastien Hinderer and David Allsopp)

  • #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)

  • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)

Bug fixes:

  • #12061, #12063: Don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)

  • #12878: Fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)

  • #12971, #12974: Fix an uncaught Ctype. Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)

  • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)

  • #11633, #11636: Bug fix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)

  • #12636, #12646: More prudent reinitialisation of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)

  • (breaking change) #10845 Emit frametable size on AMD64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
  • #12958: Fix tail-modulo-cons compilation of try-with, &&, and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

Two months after the release of OCaml 5.1.1, the set of new features for the future version 5.2.0 of OCaml has been frozen. We are thus happy to announce the first alpha release for OCaml 5.2.0.

This alpha version is here to help fellow hackers join us early in our bug hunting and opam ecosystem fixing fun (see below for the installation instructions).

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.2.0 meta-issue. The full release is expected around April.

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

If you are interested in the ongoing list of new features and bug fixes, the updated change log for OCaml 5.2.0 is available on GitHub.


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.2.0~alpha1

For previous version of opam, the switch creation command line is slightly more verbose:

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

The source code for the alpha is also available at these addresses:

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.2.0~alpha1+options <option_list>

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

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

The command line above is slightly more complicated for opam version anterior to 2.1:

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

In both cases, all available options can be listed with opam search ocaml-option.

Feedback on this post is welcomed on Discuss!

We are happy to announce the first beta release of opam 2.2.0. It contains some fixes and a new feature for Windows. You can view the full list in the release note.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Major change: Check and advertise to use Git for Windows

Opam 2.2 is based on a Cygwin installation (previously installed, or managed internally by opam). Cygwin's Git has three known usability issues when used outside a Cygwin environment: it uses a different set of trusted certificate authorities, has its own Credential Manager and potentially uses a separate Git configuration. We therefore recommend using Git for Windows either installed manually or via winget.

At opam init, opam checks for available Git(s), and asks the user to choose one of the available, or to rerun opam init after installing another Git.

Other noteworthy changes

  • When compiling opam on Windows with MinGW, the resulting opam binary now contains libstdc++ instead of requiring the DLL to be distributed alongside it or present in the environment
  • Fix opam env containing carriage return on Cygwin - eval $(opam env) now works from a Cygwin bash terminal

Miscellaneous changes

  • Remove stray comments from pwsh and cmd opam env output
  • Add ./configure --enable-static to compile the opam binary statically on Linux
  • Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD
  • Upgrade to, and require mccs >= 1.1+17
  • Fix opam tree options --dev and --no-switch

Various other improvements were made and bugs were fixed. API changes are denoted in the release note linked above. This release also includes PRs improving the documentation and improving and extending the tests.

Windows Support

The main opam-repository Windows compliance is still a work in progress, we recommend to use existing compatible repository (originally from @fdopen) and 32/64 bit mingw-w64 packages (by @dra27).

How to Test opam on Windows

If you're feeling adventurous, you can use the experimental pre-built binary for Windows available here.

Otherwise you can compile opam yourself using the following steps:

This beta requires a preexisting Cygwin installation for compiling opam.

  1. Check that you have all dependencies installed:
  • autoconf, make, patch, curl
  • MinGW compilers: mingw64-x86_64-gcc-g++, mingw64-i686-gcc-g++
  • Or if you want to use the MSVC port of OCaml, you'll need to install Visual Studio or Visual Studio Build Tools
  1. Download & extract the opam archive
  2. In the directory, launch make cold
  3. A coffee later, you now have an opam executable!
  4. Start your preferred Windows terminal (cmd or PowerShell), and initialise opam with the Windows sunset repository:
  • opam init git+https://github.com/ocaml-opam/opam-repository-mingw

From here, you can try to install the sunset repository packages. If you find any bugs, please submit an issue. It will help opam-repository maintainers to add Windows repository packages into the main repository.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~beta1"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

Two months (and half) after the release of OCaml 5.1.0, we have discovered three significant regressions in OCaml 5.1.0, affecting the packaging of executables, the typechecking of OCaml programs, and the performance of numerical codes.

Since those regressions affect many users and could have lasting effects, we have decided to cut a patch release of OCaml 5.1 with fixes for those issues next week.

To give time for opam packages to test this patch version, we have just published a first release candidate for OCaml 5.1.1 . The full list of changes in this release candidate is available below.

As a major exception to our policy for patch releases, OCaml 5.1.1 will contain one breaking change in the standard library: the Compression flag has been removed from the Marshal module. This drastic measure was taken because supporting zstd compression in the standard library made zstd a dependency of all OCaml executables. Since the compiler should not impose its dependency on end-users, the support for compressed marshaling has been moved to a compiler internal library in 5.1.1. This internally library might be released as an independent library in later releases of OCaml but not in OCaml 5.1.1 to give us time to polish the library integration and packaging.

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.1~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.1~rc1+options <option_list>

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

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

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

See full backstage

Changes in OCaml 5.1.1

Standard Library Dependency Fix:

  • (breaking change) #12562, #12734, #12783: Remove the Marshal.Compression flag to the Marshal.to_* functions introduced in 5.1 by #12006, as it cannot be implemented without risking to link -lzstd with all ocamlopt-generated executables. The compilers are still able to use ZSTD compression for compilation artefacts. (Xavier Leroy and David Allsopp, report by Kate Deplaix, review by Nicolás Ojeda Bär, Kate Deplaix, and Damien Doligez).

Type System Bug Fix:

  • #12623, fix the computation of variance composition (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer)

GC Performance Regression Fixes

  • #12590, #12595: Move caml_collect_gc_stats_sample in caml_empty_minor_heap_promote before barrier arrival. (B. Szilvasy, review by Gabriel Scherer)

  • #12318: GC: simplify the meaning of custom_minor_max_size: blocks with out-of-heap memory above this limit are now allocated directly in the major heap. (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer)

  • #12439: Finalize and collect dead custom blocks during minor collection (Damien Doligez, review by Xavier Leroy, Gabriel Scherer and KC Sivaramakrishnan)

  • #12491, #12493, #12500, #12754: Do not change GC pace when creating sub-arrays of bigarrays (Xavier Leroy, report by Ido Yariv, analysis by Gabriel Scherer,

Miscellaneous Bug Fixes

  • #12581, #12609: Fix error on uses of packed modules outside their pack to correctly handle nested packs (Vincent Laviron, report by Javier Chávarri, review by Pierre Chambart)

  • #12757: Fix ocamlnat (native toplevel) by registering frametables correctly (Stephen Dolan, Nick Barnes and Mark Shinwell, review by Vincent Laviron and Sébastien Hinderer)

  • #12645, #12649 fix error messages for cyclic type definitions in presence of the -short-paths flag. (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer)

About six months ago, opam-repo-ci (opam.ci.ocaml.org) suffered from a lack of system memory (issue 220) which caused it to be moved to the machine hosting ocaml-ci (ocaml.ci.dev).

Subsequently, that machine suffered from BTRFS volume corruption (issue 51). Therefore, we moved both services to a larger new server. The data was efficiently migrated using BTRFS tools: btrfs send | btrfs receive.

Since the move, we have seen issues with BTRFS metadata. Plus, we have suffered from a build-up of subvolumes, as reported by other users: Docker gradually exhausts disk space on BTRFS.

Unfortunately, both services went down on Friday evening (issue 85). Analysis showed over 500 BTRFS subvolumes, a shortage of metadata space, and insufficient space to perform a BTRFS rebalance.

Returning to the original configuration of splitting the ci.dev and OCaml.org services, they have been moved onto new and separate hardware. The underlying filesystem is now a RAID1-backed ext4, formatted with -i 8192 in order to ensure the availability of sufficient inodes. Docker uses Overlayfs. RSYNC was used to copy the databases and logs from the old server. This change should add resilience and has doubled the capacity for storing history logs.

Feedback on this post is welcomed on Discuss!

We are happy to announce the third alpha release of opam 2.2.0. It contains some fixes and a new feature for Windows. You can view the full list in the release note.

This version is an alpha, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Major change: Environment variables handling on Windows

opam files now support a new x-env-path-rewrite field which specifies rewriting rules for the environment variable updates defined in the setenv and build-env fields. This field allows greater control over the separator character used for PATH-like fields (i.e. ; vs :), conversion of slashes to backslashes, and even conversion from Windows native path format (C:\cygwin64\home\dra\.opam) to Cygwin format (/home/dra/.opam).

The rewriting rules allow opam directory-like variables (e.g. the %{lib}% directory of a switch) to be used in setenv and build-env fields in a portable way.

For example, given:

setenv: [
  [PKG_CONFIG_PATH += "%{lib}%/pkgconfig"]
  [PATH += "%{share}%/bin"]
]
x-env-path-rewrite: [
  [ PKG_CONFIG_PATH ":" "host" ]
  [ PATH (":" {os != "win32"} | ";" {os = "win32"}) ("target" {os != "win32"} | "target-quoted" {os = "win32"}) ]
]

the environment variable changes given by opam env on Windows would be:

PKG_CONFIG_PATH='/cygdrive/c/Users/DRA/AppData/Local/opam/default/lib/pkgconfig[:<rest-of-PKG_CONFIG_PATH, if given>]'
PATH='C:\Users\DRA\AppData\Local\opam\default\share\bin;C:\Users\DRA\AppData\Local\opam\default\bin;<rest-of-PATH>'

with the following interesting parts for Windows users:

  • PKG_CONFIG_PATH, which is consumed by a Cygwin-tool, has the directory given in Unix-like syntax, and opam's share variable was automatically converted
  • The correct separator is used for each (: for PKG_CONFIG_PATH, ; for PATH is used when adding entries)
  • In the PATH update, /bin was converted to \bin

Note that the specification for PATH is opam's default behaviour, so it's not actually necessary to have this formula for PATH in the x-env-path-rewrite field.

The full syntax is described in full in the manual.

Opam files carrying this new field are still compatible with the opam 2.0 syntax as it is an extension field, however its effect is only available with opam 2.2.0~alpha3 and above. If you want to make sure users of the package containing it have a compatible opam, you can use the available field to that end:

available: opam-version >= "2.2.0~alpha3"

or, if the change is Windows-specific:

available: opam-version >= "2.2.0~alpha3" | os != "win32"

Other noteworthy changes

  • Sandbox: /tmp is now writable again, restoring POSIX compliance
  • opam tree: opam tree package.version is now supported, displaying the dependency tree of a specific version of a package
  • opam tree: --recurse and --subpath are supported for directory arguments
  • opam admin: new add-extrafiles command to add/check/update the extra-files: field according to the files present in the files/ directory
  • opam lint: new syntax allow marking a set of warnings as errors e.g. -W @1..9
  • Releases: Pre-built binaries now include ppc64le and s390x

Miscellaneous changes

  • A handful of issues related to the compilation of opam on Windows were fixed
  • Bugs in the handling of the OPAMCURL, OPAMFETCH and OPAMVERBOSE environment variables were fixed
  • Bugs in the handling of the --assume-built argument were fixed
  • Sporadic crashes and segfaults during shell detection on Windows were fixed

Various other improvements were made and bugs were fixed. API changes are denoted in the release note linked above. This release also includes a handful of PRs improving the documentation and more than a dozen PRs improving and extending the tests.

Windows Support

The main opam-repository Windows compliance is still a work in progress, we recommend to use existing compatible repository (originally from @fdopen) and 32/64 bit mingw-w64 packages (by @dra27).

How to Test opam on Windows

If you're feeling adventurous, you can use the experimental pre-built binary for Windows available here. It should work but since it's our first public pre-built binary for Windows please use at your own risk.

Otherwise you can compile opam yourself using the following steps:

This alpha requires a preexisting Cygwin installation for compiling opam.

  1. Check that you have all dependencies installed:
  • autoconf, make, patch, curl
  • MinGW compilers: mingw64-x86_64-gcc-g++, mingw64-i686-gcc-g++
  • Or if you want to use the MSVC port of OCaml, you'll need to install Visual Studio or Visual Studio Build Tools
  1. Download & extract the opam archive
  2. In the directory:
  • if you are using MSVC: launch make cold
  • if you are using MinGW: make sure the path to the libc dlls are in your PATH and launch make cold. For instance: export PATH='C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin':$PATH && make cold. Don’t forget to update PATH accordingly or place the opam binary in the same directory as the libc dlls if you want to move the resulting opam binary.
  • alternatively, if you're using MinGW: make cold CONFIGURE_ARGS=--with-private-runtime. If you change the location of the resulting opam binary, don't forget to copy Opam.Runtime.amd64 directory (or Opam.Runtime.i386) in the same directory.
  1. A coffee later, you now have an opam executable!
  2. Start your preferred Windows terminal (cmd or PowerShell), and initialise opam with the Windows sunset repository:
  • opam init git+https://github.com/ocaml-opam/opam-repository-mingw

From here, you can try to install the sunset repository packages. If you find any bugs, please submit an issue. It will help opam-repository maintainers to add Windows repository packages into the main repository.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~alpha3"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

Previously the infrastructure team had made FreeBSD available for opam-repo-ci. Now we can announce that the same support has been added to ocaml-ci, giving coverage for both OCaml 4.14 and the new OCaml 5.1 release. opam-repo-ci has also been upgraded to support OCaml 5.1. We aim to support both 4.14 as the Long Term Support release and the latest 5.* release.

Additionally an opam-health-check instance has been setup to provide continuous checking of opam repository packages against FreeBSD 13.2 x86_64 for both the 4.14 and 5.1 releases of OCaml. This will allow the community to check whether packages work on FreeBSD and provide fixes to opam-repository that will then get tested on FreeBSD. Closing the loop and giving the community the tools to support OCaml on FreeBSD effectively.

We hope the community finds the FreeBSD support useful.

Since last week, there were two significant bugs fixed in the OCaml 5.1.0 runtime (one overflow bug and a stack corruption bug in the s390x port). Since those bug fixes are as small as they are subtle, they were deemed worthy of a release of a third release candidate for OCaml 5.1.0.

If there are no more surprises this week, the release of OCaml 5.1.0 shall happen next week.

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

The full changelog for OCaml 5.1.0 is available on GitHub

A short summary of the two fixed bugs in this release candidate 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~rc3

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~rc3+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~rc3+flambda+nffa ocaml-variants.5.1.0~rc3+options ocaml-option-flambda ocaml-option-no-flat-float-array

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

See full backstage

Last Second Bug Fixes

  • #11284, +#12525: Use compression of entries scheme when pruning mark stack. Can decrease memory usage for some workloads, otherwise should be unobservable. (Tom Kelly, review by Sabine Schmaltz, Sadiq Jaffer, and Damien Doligez)

  • #12486: Fix delivery of unhandled effect exceptions on s390x (Miod Vallat, report by Jan Midtgaard, review by Vincent Laviron and Xavier Leroy)

If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.