Is it currently possible to use ppx_deriving in a jbuilder project



Is there a (not too complex) way to have jbuilder successfully build a small project relying on ppx_deriving?

“not too complex”: because I’ll do it with ocamlbuild if it appears to be simpler

I tried to add (preprocess (pps (ppx_deriving.enum))) to my library, but when compiling the relevant module, the functions that should be generated by ppx_deriving are not found.

Thanks for any tip


As far as I can tell - no. I gave it a go to make ppx_deriving work with jbuilder a few weeks back However, due to time constraints I had to abandon my attempt. I am guessing ppx_deriving plugin based design + omp has something to do with it.


There have been a few attempts. Currently it seems that you only need to wait for this to be merged:


I’d like to use ppx_deriving_yojson with jbuilder. I’ve tried pinning ppx_deriving to ppx_deriving#141 as suggested, but my project still fails to compile:

Error: Attribute `deriving' was not used

Has anybody successfully used ppx_deriving with jbuilder? Would greatly appreciate more details on how to get jbuilder working with ppx_deriving_yojson (or another ppx_deriving-plugin).


I think ppx_derivign_yojson also needs to be ported to ocaml-migrate-parsetree (on the lines of ± adaptations), but I might be wrong.


I’m running into something which I think is an instance of this issue, but I’m not sure. I’m using a jbuild file which has (preprocess (pps (ppx_jane ppx_deriving.std))), but when running jbuilder build @install I get errors such as the following for eq and enum:

         ppx lib/ (exit 1)
(cd _build/default && ./.ppx/ppx_jane+ppx_deriving.std/ppx.exe --dump-ast --cookie 'library-name="frenetic"' -o lib/ --impl lib/
File "lib/", line 8, characters 55-72:
Error: ppx_type_conv: 'eq' is not a supported type type-conv generator

Is this the same issue as previously described in the thread?


If you want to use ppx_deriving in the mean time, with pds, one can do deps = ["ppx_deriving.blah"] or deps = ["ppx_deriving_yojson"], although it applies to a whole project rather than just to specific source files.


I wanted the same: ppx_deriving works with jbuilder now, but you’ll need ppx_deriving_yojson with this change (pin or wait for it to get merged/released) ppx_deriving_yojson#60. With that, it works now!