Hey !
I can’t figure out why I am not able to install ocaml-lsp-server and ocaml-format-lib packages for VS code (from the guide of the OCaml site: Configuring Your Editor · OCaml Documentation ). I am on Ubuntu 24.10 and I am running the installation command from my own switch.
I get this while trying to install those :
$ opam switch
# switch compiler description
default ocaml-system.5.2.0 ocaml >= 4.05.0
→ my_project ocaml-system.5.2.0 ocaml-base-compiler = 5.2.0 | ocaml-system
= 5.2.0
hugo@hugo-Legion-Slim-7-16APH8:~$ opam install ocaml-lsp-server ocamlformat
The following actions will be performed:
=== install 3 packages
∗ ocaml-lsp-server 1.19.0
∗ ocamlformat 0.26.2
∗ ocamlformat-lib 0.26.2 [required by ocamlformat]
Proceed with ∗ 3 installations? [y/n] y
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved ocaml-lsp-server.1.19.0 (cached)
⬇ retrieved ocamlformat.0.26.2, ocamlformat-lib.0.26.2 (cached)
[ERROR] The compilation of ocaml-lsp-server.1.19.0 failed at "dune build -p
ocaml-lsp-server -j 15 @install".
[ERROR] The compilation of ocamlformat-lib.0.26.2 failed at "dune build -p
ocamlformat-lib -j 15 @install".
#=== ERROR while compiling ocamlformat-lib.0.26.2 =============================#
# context 2.2.1 | linux/x86_64 | ocaml-system.5.2.0 | https://opam.ocaml.org#6383bc5431ca714c10b4e29dbf7eda9572a4ac07
# path ~/.opam/my_project/.opam-switch/build/ocamlformat-lib.0.26.2
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ocamlformat-lib -j 15 @install
# exit-code 1
# env-file ~/.opam/log/ocamlformat-lib-31467-c66592.env
# output-file ~/.opam/log/ocamlformat-lib-31467-c66592.out
### output ###
# (cd _build/default && /usr/bin/ocamlc.opt -w -40 -noassert -w -50 -g -bin-annot -bin-annot-occurrences -I vendor/odoc-parser/.odoc_parser.objs/byte -I /home/hugo/.opam/my_project/lib/astring -I /home/hugo/.opam/my_project/lib/result -I /usr/lib/x86_64-linux-gnu/ocaml/5.2.0/camlp-streams -no-alias-deps -open Odoc_parser__ -o vendor/odoc-parser/.odoc_parser.objs/byte/odoc_parser__Syntax.cmi -c [...]
# File "vendor/odoc-parser/syntax.mli", line 5, characters 28-36:
# 5 | Token.t Loc.with_location Stream.t ->
# ^^^^^^^^
# Error: Unbound module "Stream"
#=== ERROR while compiling ocaml-lsp-server.1.19.0 ============================#
# context 2.2.1 | linux/x86_64 | ocaml-system.5.2.0 | https://opam.ocaml.org#6383bc5431ca714c10b4e29dbf7eda9572a4ac07
# path ~/.opam/my_project/.opam-switch/build/ocaml-lsp-server.1.19.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ocaml-lsp-server -j 15 @install
# exit-code 1
# env-file ~/.opam/log/ocaml-lsp-server-31467-6b0d4c.env
# output-file ~/.opam/log/ocaml-lsp-server-31467-6b0d4c.out
### output ###
# [...]
# /usr/lib/x86_64-linux-gnu/ocaml/5.2.0/camlp-streams/camlp_streams.cmxa
# (cd _build/default && /usr/bin/ocamlc.opt -w -40 -alert -unstable -w -a -alert -all -g -bin-annot -bin-annot-occurrences -I vendor/odoc-parser/src/.odoc_parser.objs/byte -I /home/hugo/.opam/my_project/lib/astring -I /usr/lib/x86_64-linux-gnu/ocaml/5.2.0/camlp-streams -no-alias-deps -open Odoc_parser__ -o vendor/odoc-parser/src/.odoc_parser.objs/byte/odoc_parser__Syntax.cmi -c -intf vendor/odo[...]
# File "vendor/odoc-parser/src/syntax.mli", line 5, characters 28-36:
# 5 | Token.t Loc.with_location Stream.t ->
# ^^^^^^^^
# Error: Unbound module "Stream"
# (cd _build/default/ocaml-lsp-server/vendor/lev && /usr/bin/x86_64-linux-gnu-gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -g -O2 -Werror=implicit-function-declaration -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -pthread -D_FILE_OFFSET_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=3 -g -I [...]
# submodules/lev/lev/vendor/ev.c:2143:31: warning: ‘ev_default_loop_ptr’ initialized and declared ‘extern’
# submodules/lev/lev/vendor/ev.c: In function ‘evpipe_write’:
# submodules/lev/lev/vendor/ev.c:2817:11: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
# submodules/lev/lev/vendor/ev.c: In function ‘pipecb’:
# submodules/lev/lev/vendor/ev.c:2852:11: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-lsp-server 1.19.0
│ λ build ocamlformat-lib 0.26.2
└─
╶─ No changes have been performed
Note : I am a beginner, I am sorry if my topic don’t have enough precisions.