Multicore with opam--instructions?

Hi, I know instructions have been posted here many times, but for people not steeped in multicore lore–where should we go to get instructions on how to try out multicore with opam? I tried to adapt the instructions from GitHub - ocaml-multicore/multicore-opam: OPAM repo for OCaml multicore development, but on creating a new switch and trying to install packages I get an error:

opam switch create 5.1.0+trunk --repositories=multicore=git+https://github.com/ocaml-multicore/multicore-opam.git,default
opam switch 5.1.0+trunk
eval $(opam env)
opam install dune utop ocaml-lsp-server

Errors:

[ERROR] Package conflict!
  * No agreement on the version of ocaml:...

(Followed by long list of constraint solver errors)

What am I missing? Is it not possible to try out the latest multicore with opam? And if I don’t have the right instructions, can we decide on a prominent place to put the correct instructions that’s easily reachable from the ocaml.org landing page? I’m happy to send a PR once I very done working instructions.

EDIT: actually looks like ocaml-lsp-server was the culprit :man_facepalming:

EDIT 2: ptime and all its reverse deps failed to install.

Error log: Error: .../ocamlbuild_plugin.cmx was built with -for-pack Ocamlbuild_pack, but the current unit Myocamlbuild is not

2 Likes

You will need Package ocamlbuild.0.14.2 by kit-ty-kate · Pull Request #22182 · ocaml/opam-repository · GitHub

Everything should be fine on 5.0.0 though. If I were you, I’d rather go with the 5.0.0 line than trunk which is always bound to be more brittle.

1 Like

In short:

opam update
opam switch create 5.0.0~alpha0
opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git

See OCaml 5.0, zeroth alpha release for the details.

Cheers,
Nicolas

Is 5.0.0~alpha1 not recommended yet?

The 5.0.0~alpha1 version is the recommended version currently.

Yes, indeed, as @octachron said, alpha1 is the recommended version.

Cheers,
Nicolas

Thanks for the hints. Here’s what I ended up doing:

opam switch create mc 5.0.0~alpha1 --repositories=mc=git+https://github.com/kit-ty-kate/opam-alpha-repository.git,default
eval $(opam env)
opam install dune utop dream

I’m getting the same error on trying to install either dream or piaf:

File "src/vendor/h2/lib/scheduler.ml", lines 34-40, characters 10-6:
34 | ..........Hashtbl.MakeSeeded (struct
35 |     type t = Stream_identifier.t
36 |
37 |     let equal = Stream_identifier.( === )
38 |
39 |     let hash i k = Hashtbl.seeded_hash i k
40 |   end)
Error: Modules do not match:
       sig
         type t = H2__.Stream_identifier.t
         val equal : Int32.t -> Int32.t -> bool
         val hash : int -> 'a -> int
       end
     is not included in Hashtbl.SeededHashedType
     The value `seeded_hash' is required but not provided

I see h2 was actually updated so that this error shouldn’t happen any more: Fix Hashtbl.MakeSeeded to be compatible with OCaml 5.0.0 (#170) · anmonteiro/ocaml-h2@11d3b67 · GitHub

And the alpha repo’s opam file was updated to point to that exact commit: opam-alpha-repository/opam at affcd0d883bb824cf674fe812dc4f32b8ec5c72b · kit-ty-kate/opam-alpha-repository · GitHub

But, it seems like both dream and piaf are pointing at the ‘old’ version of h2 which does not include seeded_hash.

On a more meta level, can we raise the visibility of these instructions a bit? Many people are excited about multicore, yet there’s no mention of it on the OCaml home page. I think we should benefit quite a lot by trying to cater to people’s enthusiasm to try the hard work that the Multicore team and everyone else put in. I honestly think we should put in a Call To Action directly on the ocaml.org landing page, above the fold, saying something like ‘Try Multicore Alpha Release’ and pointing to (current, updated) instructions.

It should also speed up the process of ironing out issues like the above, if more people try it out and file reports. Right now it feels like we are crawling along to release ‘someday’.

2 Likes

Increasing the visibility of the OCaml 5 release is part of my plans for the beta releases. Right now during the alpha releases, there are still some on-going API and internal fixes that might break early adopter code. But that should be stabilized soon: there is only a handful of bugs blocking the beta left.

6 Likes

If anyone is interested–I wrote a post with a Multicore/Eio experiment: Practical OCaml, Multicore Edition - DEV Community 👩‍💻👨‍💻

3 Likes