Ocaml-beta unmet availability conditions: enable-ocaml-beta-repository

My default compiler is ocaml 4.07, and I’m trying to upgrade to ocaml 4.11.0

Here is my failed attempt :

$ opam switch create second_opam 4.11.0+trunk+flambda
[ERROR] Could not resolve set of base packages:
The following dependencies couldn’t be met:
- ocaml-variants → ocaml-beta
unmet availability conditions: enable-ocaml-beta-repository

Switch initialisation failed: clean up? (‘n’ will leave the switch partially installed) [Y/n] Y
$ opam install ocaml-beta
[ERROR] ocaml-beta unmet availability conditions: enable-ocaml-beta-repository

What is the correct way to do this ?

The 4.11.0 version isn’t released yet. The +trunk part of the version means it tracks the development branch for the given version. If you want to upgrade your compiler to the latest version, 4.10.0 is a better choice. If you want to try the not yet released version 4.11.0, then you need to add an extra repository that enables support for experimental versions.
The description of the ocaml-beta package shows a few commands you can use for that, for example you can add --repositories ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git to your switch creation command.

1 Like

Thx for the feedback. I successfully upgraded to 4.10.0, and now the bare ocaml toplevel works fine with the new compiler. However, utop crashes immediately with the following message :

$ utop
Fatal error: cannot load shared library dlllwt_unix_stubs
Reason: dlopen(dlllwt_unix_stubs.so, 10): image not found 

It seems that my utop or Lwt version is out of sync with the current ocaml compiler version ? This, even though I did an opam update followed by an opam upgrade --verbose which returns the following :

$ opam upgrade --verbose
Everything as up-to-date as possible (run with --verbose to show unavailable upgrades).
However, you may "opam upgrade" these packages explicitly, which will ask permission to downgrade or uninstall the conflicting packages.
Nothing to do.

I finally fixed it doing opam upgrade utop.