ocaml / ocamlfind

The OCaml findlib library manager
Other
30 stars 30 forks source link

Fix opam upgrade to ocamlfind 1.9.6 for OCaml 5.x #61

Closed dra27 closed 3 weeks ago

dra27 commented 1 year ago

A compatibility check in the configure script when dealing with OCaml 5's preconfigured META files is failing in opam when upgrading from ocamlfind 1.9.5.

The test is supposed to ensure that if ocamlfind has been configured with -sitelib $(ocamlc -where) then it doesn't add ocamlc -where to ocamlpath (this reflects OS-distributed ocamlfind, IIRC).

Rather than risking string comparison of paths, the test for whether -sitelib is $(ocamlc -where) is done by looking ${ocaml_sitelib}/stdlib/META. Unfortunately, in an opam switch with OCaml 5 and ocamlfind 1.9.5 already installed, -sitelib is the $(opam var lib) and ${ocaml_sitelib}/stdlib/META will be the ocamlfind 1.9.5 META causing this test to fail.

The effect is that this sequence:

opam switch create 5.0 ocaml-base-compiler.5.0.0
opam install ocamlfind.1.9.5
opam install ocamlfind.1.9.6
ocamlfind list

will not include any of the OCaml findlib packages (unix, etc.).

The fix is simple, and can be carried in an ocamlfind.1.9.6-1 package in opam.

dra27 commented 2 months ago

@gerdstolpmann - this one's critical for a 1.9.7, as the Windows machines presently upgrading from 1.9.5 will otherwise fail

gerdstolpmann commented 1 month ago

Regardingn backward compatibility with older OCaml versions: do you know when stdlib.cmi was introduced?

dra27 commented 1 month ago

stdlib.cmi was introduced in OCaml 4.08 - but note that here it's being used in an if which has already ensured that we're looking OCaml 5.0+