tarides / opam-monorepo

Assemble dune workspaces to build your project and its dependencies as a whole

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

--ocaml-version can cause solver failures

NathanReb opened this issue · comments

I tried running opam monorepo lock --ocaml-version 4.13.2 and got the following error:

- ocaml -> (problem)
                   User requested = 4.13.2
                   ocaml-base-compiler 4.14.0~beta1 requires = 4.14.0
                   Rejected candidates:
                     ocaml.4.13.2: Incompatible with restriction: = 4.14.0

Adding an upper bound directly in the opam file didn't lead to the same error.

We need to investigate this as we're probably confusing the solver because an obvious solution exists and it can't find it for some reason. I think it has to do with the ocaml-base-compiler dep we inject to prevent it from selecting variants.

Ok so looking into this a little bit, it seems that there is an ocaml.4.13.2 package but no ocaml-base-compiler.4.13.2 so there is indeed no solution.

We can probably look into what we pass to the solver to improve this a little bit. It's very specific case but one that is likely to happen again.

I think we could fix it by improving how we ensure variants are not selected, especially when we also require a specific ocaml version.

This is #351, closing as a duplicate.