Indeed, what you need to understand is that there are four kind of names:
opam
package names (e.g.ocaml
)ocamlfind
packages names (what dune calls library names, e.g.compiler-libs.common
)- OCaml library archive names (e.g.
ocamlcommon.cm[x]a
) - OCaml module names (more precisely compilation unit names, derived from source files)
None of these names need to coincide or be included in each other and there is no one-to-one mapping. An opam
package name represents a set of ocamlfind packages. An ocamlfind package represent library archives to link (but nowadays are mostly one-to-one with library archives) and an archive name represents a set of modules: those that are contained therein.
Yes, it’s an embarrassing mess.
I once spent a significant amount of energy to try to clear it with a complete compability story here. But there is no interest. Upstream doesn’t seem to care[1], and dune
people seem happy to live in their own bubble.
Which is rather unfortunate. Leaving the dependency and linking model up for interpretation is not such a good idea. Equipped with these in the compiler there are quite a few places where the user experience can be improved. ↩︎