The confusing part, here, — apologies for it — is that the
ocaml package is actually a virtual one, that serves as a transition layer between the usual packages (that should just state
depends: "ocaml"), and the various implementation
ocaml-variants. It will refuse to install, as it did above, if the actual implementation found doesn’t match its version.
opam switch create <switch-name> <ocaml-package>, but with some magic allowed (when the name and package are the same, and if you specify a non-ambiguous version instead of a package name, it will still work). The alternative is
opam switch create <name> --empty, which doesn’t set any base packages and lets you free to deal with the compiler as with other packages. (side note: using
--empty may lead to poor to terrible performance with
aspcud, on the current release, but is much better with the new built-in solver on recent