/usr/local/lib/ocaml/pervasives.cmi
and /usr/local/lib/ocaml/camlp4/camlp4.cmi
This implies that you are using system installed versions of ocaml and camlp4. This is always a more fragile setup. You should do something like opam switch 4.04.1
to make a new switch and then install things in there.
If you are already on a non-system switch then something is going wrong somewhere so that one of the build systems is trying to use the system installed ocaml and camlp4 rather than the ones from the switch.