Failed to install pfff with opam, with "make Error 1" message

I am trying to install the pfff package on my Mac.
Below is the output of opam install pfff, not sure where to start to look for a way to fix this.

$ opam install pfff
The following actions will be performed:
βˆ— install pfff 0.40.4

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><> :camel:
[pfff.0.40.4] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> :camel:
[ERROR] The compilation of pfff failed at β€œ/Users/jonathandoyle/.opam/opam-init/hooks/sandbox.sh
build make depend”.

#=== ERROR while compiling pfff.0.40.4 ========================================#

context 2.0.0 | macos/x86_64 | ocaml-base-compiler.4.11.0 | https://opam.ocaml.org#29fbc663

path ~/.opam/4.11.0/.opam-switch/build/pfff.0.40.4

command ~/.opam/opam-init/hooks/sandbox.sh build make depend

exit-code 2

env-file ~/.opam/log/pfff-79847-e7966f.env

output-file ~/.opam/log/pfff-79847-e7966f.out

output

[…]

type_reference

union_type

variable_decl

variable_decl_no_in

variable_stmt

with_stmt

xhp_attribute

xhp_attribute_value

xhp_child

xhp_html

make[1]: *** [parser_js.ml] Error 1

make: *** [depend] Error 2

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> :camel:
β”Œβ”€ The following actions failed
β”‚ Ξ» build pfff 0.40.4
└─
╢─ No changes have been performed

https://github.com/returntocorp/pfff/blob/91da31dff6cf1685354c512b3aafab8371631c36/lang_js/parsing/Makefile#L73

Looks like this is the command that is failing. Adding -t (table mode) or --code-ancient makes that work, so my assumption is the the newish code backend of menhir is not compatible with the released version pfff: https://gitlab.inria.fr/fpottier/menhir/blob/master/CHANGES.md#anchor-20211230

Options are to install an old version of menhir, or pin the development branch of pfff

opam pin add pfff https://github.com/returntocorp/pfff.git#develop

I’ve created a PR to fix the opam installation issue with current Menhir, so once this is merged this problem should go away and as @sagra mentioned, the development version of pfff doesn’t have this issue anymore.

1 Like

@jonathandoyle Also note that the pfff released on Opam is version 0.40.4, and was released almost 3 years ago. The develop branch is up to version 0.118.0 and is almost 1000 commits ahead. The pfff wiki has install instructions, and they only use opam for dependencies.