I’m using Emacs (technically Spacemacs) to build an OCaml project on macOS High Sierra using OPAM and jbuilder, but it looks like the build command (which just calls jbuilder build) is picking up the wrong environment. Firstly, the OCaml compiler invoked is /usr/local/bin/ocamlopt.opt even though I have a local 4.04 installed via opam switch. Second the libraries passed to it with -I flag are a combination of directories from the local switch and from /usr/local/lib.
The actual errors I get are:
File unavailable: /usr/local/lib/ocaml/nums.cmxa
and
File "_none_", line 1:
Error: The file /Users/basus/.opam/4.04.1/lib/ocaml-migrate-parsetree/driver-main/migrate_parsetree_driver_main.cmxa is not a compilation unit description
I don’t get this error either from compiling from the shell, or from compiling under Spacemacs with the same config on Arch Linux. I don’t know how to go about fixing or debugging this.