tarides / opam-monorepo

Assemble dune workspaces to build your project and its dependencies as a whole
ISC License
131 stars 27 forks source link

Solver can select ocaml-base-compiler and ocaml-variant at the same time #340

Open kit-ty-kate opened 2 years ago

kit-ty-kate commented 2 years ago
$ opam switch create test ocaml-base-compiler.5.0.0~beta1
$ opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository
$ opam pin git+https://github.com/kit-ty-kate/mirage#500
$ git clone https://github.com/mirage/mirage-skeleton
$ cd mirage-skeleton/tutorial/noop
$ mirage configure -t hvt
$ make depends
Selected: astring.0.8.5+dune base.v0.15.1 base-bigarray.base base-bytes.base
          base-threads.base base-unix.base bheap.2.0.0 cmdliner.1.1.1+dune
          cppo.1.6.9 csexp.1.5.1 cstruct.6.1.1 domain-name.0.4.0 dune.3.5.0
          dune-configurator.3.5.0 duration.0.2.1 findlib.1.8.1+dune
          fmt.0.9.0+dune functoria-runtime.4.3.0 ipaddr.5.3.1
          logs.0.7.0+dune2 lwt.5.6.1 macaddr.5.3.1 metrics.0.4.0
          mirage-bootvar-solo5.0.6.0 mirage-clock.4.2.0
          mirage-clock-solo5.4.2.0 mirage-logs.1.2.0 mirage-profile.0.9.1
          mirage-runtime.4.3.0 mirage-solo5.0.9.1 noop-hvt.zdev num.1.4+dune2
          ocaml-base-compiler.4.14.0 ocaml-compiler-libs.v0.12.4
          ocaml-config.3 ocaml-options-vanilla.1 ocamlfind.1.8.1+dune
          ocplib-endian.1.2 parse-argv.0.2.0 parsexp.v0.15.0
          ppx_cstruct.6.1.1 ppx_derivers.1.2.1 ppxlib.0.28.0
          ptime.1.0.0+dune2 sexplib.v0.15.1 sexplib0.v0.15.1
          stdlib-shims.0.3.0 ocaml-base-compiler&noop-hvt ocaml-base-compiler
          ocaml ocaml-variants ocaml-variants
- ocaml -> ocaml.5.0.0
    User requested = 5.0.0
- ocaml-variants -> (problem)
    Rejected candidates:
      ocaml-variants.5.1.0+trunk: In same conflict class (ocaml-core-compiler) as ocaml-base-compiler
      ocaml-variants.5.0.0+trunk: In same conflict class (ocaml-core-compiler) as ocaml-base-compiler
      ocaml-variants.5.0.0~beta1+options: In same conflict class (ocaml-core-compiler) as ocaml-base-compiler
      ocaml-variants.5.0.0~alpha1+options: In same conflict class (ocaml-core-compiler) as ocaml-base-compiler
      ocaml-variants.5.0.0~alpha0+options: In same conflict class (ocaml-core-compiler) as ocaml-base-compiler
      ...
Leonidas-from-XIV commented 1 year ago

We need to investigate why the Selected line contains ocaml-base-compiler&noop-hvt ocaml-base-compiler ocaml ocaml-variants ocaml-variants, that is both the base-compiler and variants, given they can't be both installed at the same time it is impossible to find a solution.

palainp commented 1 year ago

I probably should have wrote https://github.com/tarides/opam-monorepo/issues/351#issuecomment-1356270300 here, but the alternatives dependencies (cf. https://github.com/ocaml/opam-repository/blob/master/packages/base-domains/base-domains.base/opam, not searched for other examples) may be related to that issue. However I'm currently not sure how to check/validate that, I just hope it can helps :)

dinosaure commented 1 year ago

I'm not sure that it's the right solution but for our context, we would like to pick the cross-compiled base-domains.base. We probably should follow what we did about zarith and take the opportunity of the --required-cross-compile option?

talex5 commented 1 year ago

We need to investigate why the Selected line contains ocaml-base-compiler&noop-hvt ocaml-base-compiler ocaml ocaml-variants ocaml-variants, that is both the base-compiler and variants, given they can't be both installed at the same time it is impossible to find a solution.

Those don't have version numbers next to them, so I suspect they're just virtual packages the solver made up to represent logic operations. It says ocaml-variants -> (problem) below, so it didn't select the package itself.