ocamlcoqcamlp4

How does one install camlp5 compatible with version 4.05.0 of ocaml?


I was trying to install tcoq and gamepad as described here but had the errors:

make
/Library/Developer/CommandLineTools/usr/bin/make --warn-undefined-variable --no-builtin-rules -f Makefile.build
OCAMLC -c -pp grammar/gramCompat.mlp
>> Fatal error: OCaml and preprocessor have incompatible versions
Fatal error: exception Misc.Fatal_error
make[1]: *** [grammar/gramCompat.cmo] Error 2
make: *** [submake] Error 2

so I discovered that I had the wrong version of campl5:

$ camlp5 -v
Camlp5 version 7.07 (ocaml 4.07.0)

since the one I need is the one compatible with ocaml 4.05.0 according to gamepad and tcoq.


Solution

  • In order to install an OCaml package compatible with a given version of OCaml, I would suggest you use opam. By looking at one of your previous questions, I assume it is already the case.

    In order to install the correct version of camlp5 for the active switch (i.e. for Ocaml 4.05.0 in your case), run the following command:

    opam install camlp5
    

    It will download the required dependencies and install it to your local opam installation folder.

    This might however cause some issues if you already have another version of camlp5 installed through your favorite packet manager (e.g. brew). See my answer to this question of yours for more details.