I’m hoping to play around with multicore, but I’m quite stuck trying to install OCaml 5, and searching hasn’t been able to turn up any set of clear instructions detailing how to create a switch for this purpose. I’m hoping someone who knows better can help unblock me and offer instructions for other curious users.
I’m trying:
$ opam switch create . 5.00.0+trunk
[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
So I then ensure that the ocaml-beta package is installed:
$ opam install ocaml-beta
[NOTE] Package ocaml-beta is already installed (current version is enabled).
With the details:
$ opam info ocaml-beta
<><> ocaml-beta: information on all versions ><><><><><><><><><><><><><><><><><>
name ocaml-beta
all-installed-versions enabled [ocaml-base-compiler.4.13.1]
all-versions disabled enabled
<><> Version-specific details <><><><><><><><><><><><><><><><><><><><><><><><><>
version enabled
repository ocaml-beta
homepage: "https://ocaml.org"
bug-reports: "https://github.com/ocaml/ocaml/issues"
authors: "Xavier Leroy"
"Damien Doligez"
"Alain Frisch"
"Jacques Garrigue"
"Didier Rémy"
"Jérôme Vouillon"
maintainer: "platform@lists.ocaml.org"
synopsis OCaml beta releases enabled
description Virtual package enabling the installation of OCaml beta releases.
This was due to me having already enabled opam-beta by following the instructions on the package, and opting to enable it for all switches.
I’ve tried the other command given in the package too:
$ opam switch create ocaml-beta --repositories ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git
[ERROR] No compiler matching 'ocaml-beta' found, use 'opam switch list-available' to see what is available, or use '--packages' to select packages explicitly.
And I’ve tried various variations thereof:
$ opam switch create . 5.00.0+trunk --repositories ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git
[ERROR] No compiler matching '5.00.0+trunk' found, use 'opam switch list-available' to see what is available, or use '--packages' to select packages explicitly.
$ opam switch list-available --repositories ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git
# Listing available compilers from repositories: ocaml-beta
# No matches found
you need both the default and the beta repos. default where ocaml-variants exists, and beta to enable trunk variants. opam switch create . 5.00.0+trunk --repos beta,default
Installing OCaml 5.00.0+trunk from a switch without ocaml-beta enabled
It seems the complete invocation to bring a user on a switch without ocaml-beta enabled onto a newly created switch for the current directory, running 5.00.0+trunk should be:
I couldn’t find this recipe clearly indicated anywhere online. It’s only two lines, but there are around 10 non-obvious elements to the invocation, so it’s worth making this clearly documented somewhere I think.
I’ll create a SO question for it. Where else should these recipe be documented for users? Do people know of places that already document this that they could link from here?
hey just one thing: since you named it ocaml-beta in your opam repos, then your invocation would be ocaml-beta,default.
; ocaml -vnum
5.00.0+dev0-2021-11-05
; opam rep
[NOTE] These are the repositories in use by the current switch. Use '--all' to
see all configured repositories.
<><> Repository configuration for switch trunk ><><><><><><><><><><><><><><><><>
1 multicore git://github.com/ocaml-multicore/multicore-opam.git
2 alpha git://github.com/kit-ty-kate/opam-alpha-repository.git
3 beta git://github.com/ocaml/ocaml-beta-repository.git
4 default https://opam.ocaml.org
and btw --repos is just short for --repositories. opam (and dune) allows any unambiguous prefix to be a shortcut for its full-length name, I have no idea why this isn’t the standard for all CLI tools… it’s so good.
as for where this recipe is outlined, I think I first picked it up from a release candidate announcement here on discuss.
I guess this may also explain why there aren’t some stable, authoritative docs on the process for old opam versions. I didn’t realize I’d fallen out of date