My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make compiler pin optional — solver picks freely when not specified

When no --ocaml-version is given, don't force ocaml-base-compiler as
a constraint or solver root. The solver discovers the compiler through
each package's ocaml dependency, allowing packages that need older
compilers or ocaml-variants to solve successfully.

Result: 4216/4420 solved (was 3257 with forced 5.4.1 pin).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+10 -13
+10 -13
day11/solver/solve.ml
··· 29 29 Context.create ~prefer_oldest ~constraints ~pins ~env ~packages:pkgs 30 30 ~doc () 31 31 in 32 - (* Use whatever compiler package is in the constraints as a root. 33 - This handles ocaml-base-compiler, ocaml-variants, etc. *) 32 + (* If a compiler is pinned in constraints, add it as a root. 33 + Otherwise let the solver discover the compiler via ocaml deps. *) 34 34 let compiler_root = 35 35 let compiler_names = List.map OpamPackage.Name.of_string 36 - [ "ocaml-base-compiler"; "ocaml-variants" ] in 37 - match List.find_opt (fun n -> 38 - OpamPackage.Name.Map.mem n constraints) compiler_names with 39 - | Some n -> n 40 - | None -> OpamPackage.Name.of_string "ocaml-base-compiler" 36 + [ "ocaml-base-compiler"; "ocaml-variants"; "ocaml-system" ] in 37 + List.find_opt (fun n -> 38 + OpamPackage.Name.Map.mem n constraints) compiler_names 41 39 in 42 40 (* Include x-extra-doc-deps as additional roots so they end up in the 43 41 solution for cross-referencing during doc generation. ··· 70 68 names 71 69 in 72 70 let extra_target_roots = List.map OpamPackage.name extra_targets in 73 - let roots = [ compiler_root; name ] 74 - @ extra_doc_roots @ extra_target_roots in 71 + let roots = 72 + (match compiler_root with Some c -> [ c ] | None -> []) 73 + @ [ name ] @ extra_doc_roots @ extra_target_roots in 75 74 match Solver.solve context roots with 76 75 | Error e -> 77 76 let examined = Context.examined_packages context in ··· 135 134 OpamPackage.Name.Map.add (OpamPackage.name pkg) 136 135 (`Eq, OpamPackage.version pkg) constraints 137 136 | None -> 138 - let name = OpamPackage.Name.of_string "ocaml-base-compiler" in 139 - if OpamPackage.Name.Map.mem name constraints then constraints 140 - else OpamPackage.Name.Map.add name 141 - (`Geq, OpamPackage.Version.of_string "4.08.0") constraints 137 + (* No compiler pin — let the solver pick freely *) 138 + constraints 142 139 143 140 let solve ~packages ~env ?constraints ?pins ?prefer_oldest 144 141 ?(doc = true) ?(extra_targets = []) ?ocaml_version target =