ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

How to compile with 5.0.0~alpha0?

Open damienstanton opened this issue 3 years ago • 4 comments
trafficstars

Currently getting this vendor error when running make install on an M1 (Arm64) macOS machine.

:: make install
dune build @install && dune install
File "ocaml-lsp-server/vendor/merlin/src/config/merlin_config.ml", line 8, characters 22-34:
8 |   | `OCaml_4_14_0 ] = `OCaml_5_0_0
                          ^^^^^^^^^^^^
Error: This expression has type [> `OCaml_5_0_0 ]
       but an expression was expected of type
         [ `OCaml_4_02_0
         | `OCaml_4_02_1
         | `OCaml_4_02_2
         | `OCaml_4_02_3
         | `OCaml_4_03_0
         | `OCaml_4_04_0
         | `OCaml_4_05_0
         | `OCaml_4_06_0
         | `OCaml_4_07_0
         | `OCaml_4_07_1
         | `OCaml_4_08_0
         | `OCaml_4_09_0
         | `OCaml_4_10_0
         | `OCaml_4_11_0
         | `OCaml_4_12_0
         | `OCaml_4_13_0
         | `OCaml_4_14_0 ]
       The second variant type does not allow tag(s) `OCaml_5_0_0

Is there a known workaround to get the lsp server working with the current alpha of ocaml 5.0.0?

damienstanton avatar Jul 06 '22 22:07 damienstanton

The temporary solution is to pin this: opam pin -y git+https://github.com/patricoferris/ocaml-lsp#dc9a4ef8529628fe023e1ed034ffe6b517ea4f1a

ulugbekna avatar Jul 07 '22 09:07 ulugbekna

Should the above work or just compile? Tried it here, but I get the following error:

Compiler version mismatch: this project seems to be compiled with a version of OCaml compiler that is not supported by the running OCaml LSP. OCaml language support will not work properly until this problem is fixed. 

Hint: It seems the project is built with a newer OCaml compiler version that the running OCaml LSP version doesn't know about. Make sure your editor runs OCaml LSP that supports this version of compiler. 

I'm using 5.0.0~alpha0

v0idpwn avatar Jul 08 '22 06:07 v0idpwn

@v0idpwn I think that you haven't restarted ocaml-lsp after pinning

ulugbekna avatar Jul 08 '22 12:07 ulugbekna

Apparently, a few hours after my comment, a new commit was added in the 5.00 compat branch. I changed the pin to use it and it works! Its 87ab11a7a88b6e47205736d972c3c4af79ee2a7e. With the old pin I get the same error, even after restarts.

v0idpwn avatar Jul 08 '22 13:07 v0idpwn

Given ocaml 5 is out, this should be no longer interesting to people.

ulugbekna avatar Dec 22 '22 14:12 ulugbekna