Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin dependency versions for dune build #158

Open
ahelwer opened this issue Oct 16, 2024 · 5 comments
Open

Pin dependency versions for dune build #158

ahelwer opened this issue Oct 16, 2024 · 5 comments

Comments

@ahelwer
Copy link
Collaborator

ahelwer commented Oct 16, 2024

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
Copy link
Collaborator

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
Copy link
Collaborator Author

ahelwer commented Oct 16, 2024

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
Copy link
Collaborator

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.

@ahelwer ahelwer changed the title Compilation error in lsp/lib/docs/doc_proof_res.ml Pin dependency versions for dune build Oct 16, 2024
@ahelwer

This comment was marked as off-topic.

@ahelwer

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants