ocaml / ocaml-lsp

OCaml Language Server Protocol implementation
Other
754 stars 117 forks source link

opam install ocaml-lsp-server fails with missing header file on freebsd #747

Open devosalain opened 2 years ago

devosalain commented 2 years ago

OS : Freebsd-version : 13.1-RELEASE ocaml --version : 4.14.0 opam --version : 2.1.2

opam install ocaml-lsp-server returns:

[ERROR] The compilation of ocaml-lsp-server.1.12.1 failed at "dune build -j 7 ocaml-lsp-server.install --release".

#=== ERROR while compiling ocaml-lsp-server.1.12.1 ============================#
# context     2.1.2 | freebsd/x86_64 | ocaml-base-compiler.4.14.0 | https://opam.ocaml.org#b1e47f67
# path        /usr/home/x/.opam/4.14.0/.opam-switch/build/ocaml-lsp-server.1.12.1
# command     /usr/home/x/.opam/4.14.0/bin/dune build -j 7 ocaml-lsp-server.install --release
# exit-code   1
# env-file    /usr/home/x/.opam/log/ocaml-lsp-server-88348-a78a24.env
# output-file /usr/home/x/.opam/log/ocaml-lsp-server-88348-a78a24.out
### output ###
# File "dune", line 52, characters 21-23:
# 52 |     (names lev_stubs ev)))))
#                           ^^
# (cd _build/default/vendor/lev && /usr/local/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -g -I /usr/home/x/.opam/4.14.0/lib/ocaml -o ev.o -c ev.c)
# submodules/lev/lev/vendor/ev.c:510:11: fatal error: sys/statfs.h: No such file or directory
# compilation terminated.

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-lsp-server 1.12.1
└─ 
╶─ No changes have been performed

Probably statfs is in header file:

/usr/include/sys/mount.h

https://www.freebsd.org/cgi/man.cgi?query=statfs&sektion=2

Also, ev.c function inotify_add_watch is located in,

include <sys/inotify.h>

https://www.freebsd.org/cgi/man.cgi?query=inotify_rm_watch

# /usr/local/bin/ld: /usr/home/x/.opam/4.14.0/.opam-switch/build/ocaml-lsp-server.1.12.1/_build/default/vendor/lev/submodules/lev/lev/vendor/ev.c:4796: undefined reference to `inotify_add_watch'
rgrinberg commented 2 years ago

Do you mind sending a PR to https://github.com/rgrinberg/lev

I don't have freebsd so I can't test the fix.

devosalain commented 2 years ago

Removing the package libinotify , ie "pkg remove -f libinotify" , makes , "opam install ocaml-lsp-server" succeed. [Don't really know why]