MSYS2 and ocaml-lsp-server

Hi everyone,

I reinstalled opam on Windows to try out the MSYS2 mode (instead of the Cygwin one), and well I think it was mostly going well, until I tried to instal ocaml-lsp-server. Being a new fresh installation, the default installed switch is currently 5.4.0, and it worked fine for all packages I wanted to test on Windows, except for the lsp:

➜  opam install ocaml-lsp-server
The following actions will be performed:
=== remove 4 packages
⊘ base-domains        base            \[conflicts with ocaml\]
⊘ base-effects        base            \[conflicts with ocaml\]
⊘ base-nnp            base            \[uses base-domains\]
⊘ ocaml-compiler      5.4.0
=== downgrade 2 packages
β†˜ ocaml               5.4.0 to 4.14.2 \[required by ocaml-lsp-server\]
β†˜ ocaml-base-compiler 5.4.0 to 4.14.2 \[required by ocaml\]
=== recompile 9 packages
↻ cppo                1.8.0           \[uses ocaml\]
↻ csexp               1.5.2           \[uses ocaml\]
↻ ctypes              0.24.0          \[uses ocaml\]
↻ ctypes-foreign      0.24.0          \[uses ocaml\]
↻ dune                3.20.2          \[uses ocaml\]
↻ dune-configurator   3.20.2          \[uses ocaml\]
↻ integers            0.7.0           \[uses ocaml\]
↻ ocaml-config        3               \[uses ocaml-base-compiler\]
↻ stdlib-shims        0.3.0           \[uses ocaml\]
=== install 29 packages
βˆ— astring             0.8.5           \[required by ocaml-lsp-server\]
βˆ— base                v0.16.4         \[required by ocaml-lsp-server\]
βˆ— base-bytes          base
βˆ— camlp-streams       5.0.1           \[required by ocaml-lsp-server\]
βˆ— chrome-trace        3.20.2          \[required by ocaml-lsp-server\]
βˆ— dune-build-info     3.20.2          \[required by ocaml-lsp-server\]
βˆ— dune-rpc            3.20.2          \[required by ocaml-lsp-server\]
βˆ— dyn                 3.20.2          \[required by ocaml-lsp-server\]
βˆ— fiber               3.7.0           \[required by ocaml-lsp-server\]
βˆ— jsonrpc             1.21.0-4.14     \[required by ocaml-lsp-server\]
βˆ— lsp                 1.21.0-4.14     \[required by ocaml-lsp-server\]
βˆ— merlin-lib          4.19-414        \[required by ocaml-lsp-server\]
βˆ— ocaml-lsp-server    1.21.0-4.14
βˆ— ocamlbuild          0.16.1          \[required by astring\]
βˆ— ocamlc-loc          3.20.2          \[required by ocaml-lsp-server\]
βˆ— ocamlfind           1.9.8           \[required by astring\]
βˆ— ocamlformat-rpc-lib 0.28.1          \[required by ocaml-lsp-server\]
βˆ— ordering            3.20.2          \[required by ocaml-lsp-server\]
βˆ— pp                  2.0.0           \[required by ocaml-lsp-server\]
βˆ— ppx_yojson_conv_lib v0.16.0         \[required by ocaml-lsp-server\]
βˆ— re                  1.14.0          \[required by ocaml-lsp-server\]
βˆ— seq                 base            \[required by yojson\]
βˆ— sexplib0            v0.16.0         \[required by base\]
βˆ— spawn               v0.17.0         \[required by ocaml-lsp-server\]
βˆ— stdune              3.20.2          \[required by ocaml-lsp-server\]
βˆ— topkg               1.1.1           \[required by astring\]
βˆ— uutf                1.0.4           \[required by lsp\]
βˆ— xdg                 3.20.2          \[required by ocaml-lsp-server\]
βˆ— yojson              2.2.2           \[required by ocaml-lsp-server\]

Proceed with ⊘ 4 removals, β†˜ 2 downgrades, ↻ 9 recompilations and βˆ— 29 installations? \[Y/n\]

Is someone able to make me understand why opam tries to downgrade the switch’s OCaml version back to 4.x? I thought maybe the .opam file of the package was the problem but I don’t know much about those and it seemed fine, I think. Also, this doesn’t happen if opam is configured to use Cygwin.

Anyway, thank you for your help in advance.

astring and uutf both require ocamlfind, and there’s no released version of that which works with OCaml 5.x on MSYS2 (see ocaml/ocamlfind#112). However, you can work around that with:

$ opam pin add -n ocamlfind git+https://github.com/dra27/ocamlfind.git#win-fixes
$ opam install ocaml-lsp-server
1 Like

Oh, I see, thank you!

Is there any idea of when this will be merged? Just curious.

Hopefully early next year, because there’s a follow-up update to ocamlfind needed for OCaml 5.5 because of the relocatable OCaml changes!

1 Like