Open tmcgilchrist opened 11 months ago
That we present odoc
with unreadable .cmi
file is, as I understand a voodoo issue: https://github.com/ocaml-doc/voodoo/issues/60. I'll put my attempted fix (https://github.com/ocaml-doc/voodoo/pull/115) on staging, so we can see if Melange 1.0.0 builds then.
I believe this is an issue on Melange side, rather than something that odoc or voodoo should fix.
Melange v1 depends on a fork of the OCaml compiler, based on the 4.14 version of OCaml, but the lower bound in opam package is 4.13 and there's no upper bound. This relaxation of bounds is beneficial in some cases (e.g. if dune devs or any user want to build melange on a 5.0 switch), but it breaks tooling like odoc or ocaml-lsp-server, that rely on the switch version to match that of Melange.
I think in subsequent versions, Melange will constraint the version of OCaml to just the one that it is compatible with, so e.g. version 2.0.0 will be compatible with just OCaml 5.1. @anmonteiro is that correct? If that's the case, this would become a non-issue.
See related: https://github.com/melange-re/melange/issues/603.
This error can also be seen in the ocaml-src.5.0.dev
and ocaml-src.5.0.0
packages so it's not just a melange issue.
$ opam switch create . 5.0.0 --no-install
$ opam install odoc.2.2.1
$ opam install ocaml-src.5.0.dev
$ odoc compile-deps _opam/lib/ocaml-src/testsuite/tests/no-alias-deps/b.cmi
odoc: internal error, uncaught exception:
Cmi_format.Error(_)
Raised at Cmi_format.read_cmi in file "file_formats/cmi_format.ml", line 82, characters 6-21
Called from Odoc_odoc__Depends.for_compile_step_cmi_or_cmti in file "src/odoc/depends.ml", line 37, characters 18-62
Called from Dune__exe__Main.Depends.Compile.list_dependencies in file "src/odoc/bin/main.ml", line 689, characters 17-72
Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 34, characters 37-44
The only thing odoc can do here is error more gracefully, but that would be a lot nicer than the horrendous backtrace, so let's do that.
Generated from voodoo using odoc 2.2.0
Full logs at https://docs.ci.ocaml.org/job/2023-07-22/144556-voodoo-do-7dec6a