ocaml / ocaml-lsp

OCaml Language Server Protocol implementation
Other
756 stars 118 forks source link

Compilation failure on FreeBSD 13.2 #1069

Open avysk opened 1 year ago

avysk commented 1 year ago
opam install ocaml-lsp-server
[blah]
┌─ The following actions failed
│ λ build ocaml-lsp-server 1.15.1-5.0
└─

I believe the relevant error is submodules/lev/lev/vendor/ev.c:510:11: fatal error: sys/statfs.h: No such file or directory. Indeed, there is no sys/statfs.h on FreeBSD; I think it is specific for GNU C library.

🌐 eldanna in ~
❯ uname -srm
FreeBSD 13.2-RELEASE amd64
🌐 eldanna in ~
❯ ocamlc --version
5.0.0
mutkach commented 1 year ago

statvfs.h is the correct FreeBSD variant, though the struct itself works different so chaning the header doesn't work. Fixed it by commenting out some statfs stuff in lev/vendor/ev.c Works fine.

avysk commented 1 year ago

Any chance to try the fix?

mutkach commented 1 year ago

as a hotfix just put these lines

#if __FreeBSD__
#define EV_USE_INOTIFY 0
#define EV_USE_KQUEUE 1
#endif

in the line 509 before #if EV_USE_INOTIFY file submodules/lev/lev/vendor/ev.c Let me know if it worked for you

avysk commented 1 year ago

I had to install yarn and a bunch of opam packages but then make install worked on 13.2-RELEASE-p2 arm64. Thanks!

voodoos commented 11 months ago

@rgrinberg is there a reason ocaml-ci is not enabled in the repository? It might help us catch this kind of issues since it runs on a wide variety of platforms and oses.

rgrinberg commented 11 months ago

No reason. I just don't know how to set it up

mro commented 1 week ago

Hi @rgrinberg,

bumped into this issue (FreeBSD 14.1) - how would I go about, just manually patch as https://github.com/ocaml/ocaml-lsp/issues/1069#issuecomment-1684916146 mentions and then $ opam install ocaml-lsp-server again?

Feels quite hacky.

rgrinberg commented 1 week ago

Submitting a PR to https://github.com/rgrinberg/lev would be a good first step.