OCaml 5.0, zeroth alpha release

Five months after the initial merge of the multicore branch into the mainline OCaml and three months after the release of OCaml 4.14.0, OCaml 5.0.0 is starting to take shape.

I am thus happy to announce an exceptional zeroth alpha release of OCaml 5.0.0 (see below for the installation instructions).

This alpha release is expected to be rougher than an usual alpha release, due to the full rewrite of the OCaml runtime. In particular, the bytecode debugger will only be available in the next alpha release. Similarly, there will be some changes to the internal C runtime API and to the files installed by the compiler package in the next alpha release.

Moreover, this zeroth alpha release is the occasion to remind everyone that OCaml 5.0 itself is expected to be a more experimental release than usual. Notably, the native compiler will only be available on the ARM64 and x86-64 architectures in this 5.0 release.

Nevertheless, this zeroth alpha version is already stable enough for fellow hackers eager to join us in our early bug hunting and opam ecosystem fixing fun, or to venture in the new era of parallelism and (experimental) effects.

You can follow the progresses in stabilising the opam ecosystem on

OCaml 5.0 Release Readiness ¡ Issue #21526 ¡ ocaml/opam-repository ¡ GitHub

A brief summary is that at least dune, merlin, ppxlib, utop, ocamlfind, and ocamlbuild work (potentially by using patches from the alpha opam repository).

If you find any bugs, please report them here:

Issues ¡ ocaml/ocaml ¡ GitHub

In particular, any sequential OCaml 4 library or program should be valid in OCaml 5 (except for deprecated modules and functions). Please don’t hesitate to report any compatibility bugs!

If you are interested by the ongoing list of bug fixes, the updated change log for OCaml 5.0.0 is available at:

ocaml/Changes at 5.0 ¡ ocaml/ocaml ¡ 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.0.0~alpha0

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

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

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

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

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0~alpha0+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.

If you want to test this version, it is strongly advised to install the alpha opam repository

with

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

This alpha repository contains various fixes in the process of being upstreamed.

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

https://github.com/ocaml/ocaml/archive/5.0.0-alpha0.tar.gz
https://caml.inria.fr/pub/distrib/ocaml-5.0/ocaml-5.0.0~alpha0.tar.gz

63 Likes

Does this mean we get global warming again ?

6 Likes

Indeed! I should have mentioned that point! The normal development process can restart on the compiler development branch.

I will also try to slowly go through the backlog of frozen PRs once the alpha releases settle down .

4 Likes

I get a failure when I try to install the alpha opam repository with the command given in the initial message of this thread:

% opam repo add alpha git://github.com/kit-ty-kate/opam-alpha-repository.git
[ERROR] Could not update repository "alpha": "/usr/bin/git fetch -q" exited with code 128
[ERROR] Initial repository fetch failed

If I use instead the command given in opam-alpha-repository’s README, it seems to work as expected:

% opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git 
[alpha] Initialised
[NOTE] Repository alpha has been added to the selections of switch 5.0 only.
       Run `opam repository add alpha --all-switches|--set-default' to use it in all existing
       switches, or in newly created switches, respectively.

When I try to install menhir and cppo (as dependencies of merlin), I get errors like:

# 17 |     unix
#          ^^^^
# Error: Library "unix" in /home/tmartine/.opam/5.0/lib/ocaml is hidden
# (unsatisfied 'exist_if')

(for menhir), or

# 21 |  (libraries unix str))
#                       ^^^
# Error: Library "str" in /home/tmartine/.opam/5.0/lib/ocaml is hidden
# (unsatisfied 'exist_if').

(for cppo)

I don’t know whether I am missing to install/activate something or if I have to report (and I don’t know where to report: is it a bug in these packages, in dune, in ocaml distribution?). Sorry if I pollute this thread!

For the alpha repository issue, I had (once more) forgotten that github had deprecated the git protocol. I have updated the command, thanks!

Concerning the dune error message, you currently need to upgrade to one of the alpha version of dune (either 3.2.0.2~alpha-repo or 2.9.3.1~alpha-repo) : released version of dune are confused by the packaging change for the libraries bundled in with the compiler (aka str, unix, compilerlibs, and dynlink).

3 Likes

Thank you very much, it works!

An upstream release of Dune is also imminent

Now is probably the time to refactor the OCaml submissions to The Benchmark Game.

8 Likes

Congrats for the zeroth alpha release! That’s an exciting moment for OCaml history :tada:

We’ve set up a quick survey at OCaml 5 Alpha Release | Tarides (direct link here: Tarides OCaml 5 User Survey | Framaforms.org) to make sure everything is ready for the community and for Tarides’ commercial partner to move to OCaml 5. Your feedback would be greatly appreciated to make sure we haven’t missed anything. Thanks!

3 Likes

Exciting news. Soon “Ocaml is great and all but it doesn’t have support for multicore.” will no longer be a legitimate excuse not to use it.

7 Likes

This will change to “OCaml is great and all but it does not have typeclasses” :slight_smile:

19 Likes

I’m getting this error when trying to install merlin:

#=== ERROR while compiling biniou.1.2.1 =======================================#
# context     2.1.0 | linux/x86_64 | ocaml-base-compiler.5.0.0~alpha0 | https://opam.ocaml.org#a4fb2082
# path        ~/.opam/5.0.0~alpha0/.opam-switch/build/biniou.1.2.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p biniou -j 3
# exit-code   1
# env-file    ~/.opam/log/biniou-46054-0b5058.env
# output-file ~/.opam/log/biniou-46054-0b5058.out
### output ###
# (cd _build/default && /home/san/.opam/5.0.0~alpha0/bin/ocamlc.opt -safe-string -g -bin-annot -I src/.biniou.objs/byte -I /home/san/.opam/5.0.0~alpha0/lib/easy-format -no-alias-deps -o src/.biniou.objs/byte/bi_stream.cmi -c -intf src/bi_stream.mli)
# File "src/bi_stream.mli", line 20, characters 59-67:
# 20 | val read_stream : (string -> 'a array) -> in_channel -> 'a Stream.t
#                                                                 ^^^^^^^^
# Error: Unbound module Stream

This looks like you have not installed the alpha repository.
Normally, if the repository is activated

opam repo

returns

<><> Repository configuration for switch 5.0.0~alpha0 <><><><><><><><><><><><><>
 1 alpha   git+https://github.com/kit-ty-kate/opam-alpha-repository.git
 2 default https://opam.ocaml.org

Then installing merlin with

opam install merlin

should ask to install the following packages

The following actions will be performed:
  ∗ install dune              3.3.1              [required by merlin]
  ∗ install ocamlfind         1.9.5              [required by dot-merlin-reader]
  ∗ install result            1.5                [required by merlin]
  ∗ install menhirSdk         20220210           [required by merlin]
  ∗ install menhirLib         20220210           [required by merlin]
  ∗ install easy-format       1.3.4              [required by yojson]
  ∗ install csexp             1.5.1              [required by merlin]
  ∗ install cppo              1.6.9              [required by yojson]
  ∗ install camlp-streams     5.0                [required by biniou]
  ∗ install menhir            20220210           [required by merlin]
  ∗ install biniou            1.2.1.1~alpha-repo [required by yojson]
  ∗ install yojson            1.7.0              [required by merlin]
  ∗ install dot-merlin-reader 4.4~5.0.preview    [required by merlin]
  ∗ install merlin            4.4.1~5.0preview

Notice that biniou version is one from teh alpha repository 1.2.1.1~alpha-repo.

oh yes indeed, thanks. Now it works!
Since installing bogue worked directly with the default repo, I was so happy thay I forgot the last line of your message :wink: