tlaplus / tlapm

The TLA Proof Manager
https://proofs.tlapl.us/
BSD 2-Clause "Simplified" License
66 stars 20 forks source link

Pin dependency versions for dune build #158

Open ahelwer opened 3 days ago

ahelwer commented 3 days ago

When running make on Arch Linux using OCaml 5.2.0:

File "lsp/lib/docs/doc_proof_res.ml", line 34, characters 40-57:
34 |         LspT.Diagnostic.create ~message:(`String ntf.msg)
                                             ^^^^^^^^^^^^^^^^^
Error: This expression has type [> `String of string ]
       but an expression was expected of type string
File "lsp/lib/docs/obl.ml", line 216, characters 36-43:
216 |       Some (LspT.Diagnostic.create ~message ~range ~severity ~source ())
                                          ^^^^^^^
Error: This expression has type [> `String of string ]
       but an expression was expected of type string
File "lsp/lib/server/handlers.ml", line 334, characters 13-35:
334 |     | Ok (E (TextDocumentDiagnostic params)) ->
                   ^^^^^^^^^^^^^^^^^^^^^^
Error: This variant pattern is expected to have type $r Lsp.Client_request.t
       There is no constructor TextDocumentDiagnostic within type Lsp.Client_request.t
make: *** [Makefile:34: build] Error 1

Bisecting reveals 6acb3cb as the commit which introduced this compilation error. It does not fail the entire compilation process for some reason.

kape1395 commented 3 days ago

You may have an old version of the ocaml lsp library. Can you try running

make opam-update
make opam-deps
make opam-deps-opt

before building the tlapm again?

ahelwer commented 3 days ago

Okay that fixes the issue! However, is there a way to pin package versions in dune so this does not happen again? Ideally it would be one command to install all dependencies of the correct version then build the project.

kape1395 commented 3 days ago

I don't know. :) I tried to find a way to fix the versions intuitively, as it is done in other programming environments, but found no good way. The versions seem to be fixed at the opam switch level, but they are not tied to a particular project. Maybe I misunderstood that; I'm a newbie in OCaml. At least I added make opam-update to the install instructions to cope with problems like this at least to some extent.

You can specify the version at the dune-project level; see this. But that solves the problem partially. The build will fail if your versions differ from those in the opam switch. And I found no way to install the dependencies based on the information in the dune-project file. Again, I haven't spent a lot of time on that. Maybe there is a solution; I'm just not aware of it.