PSA: Workaround when upgrading to ocamlfind 1.9.6 with OCaml 5 in opam

ocamlfind 1.9.6 was released to opam-repository two days ago. If you are using an OCaml 5 switch, you may start seeing errors in Dune builds about being unable to find the threads, unix or other core distribution libraries.

If you run ocamlfind list you’ll see that these packages are missing, along with all the core OCaml packages. The issue is opam-specific, and affects upgrading to ocamlfind 1.9.6 only and doesn’t affect OCaml 4.x switches. If you’re creating a new switch with OCaml 5 and install ocamlfind, everything will work.

ocaml/opam-repository#23480 will fix this permanently. In the meantime, an affected switch is permanently fixed by running opam reinstall ocamlfind.

CI systems usually install dependencies from scratch, rather than upgrading switches, so I expect this is mostly affecting local development only.

7 Likes