Hi,
You might have exeperienced issues recently related to bad
interactions between ppx_type_conv and ppx_deriving. Work was done
to improve the situation, and since
this last PR yesterday
I expected that all remaining issues are gone.
In particular, if you have been using both ppx_deriving plugins such
as ppx_deriving_yojson and ppx_type_conv plugins such as
ppx_sexp_conv on the same files, then everything should work
properly again. You should also be able to upgrade to OCaml 4.06
without additional issues.
I did some work earlier this year in order to satisfy a growing demand
of being able to use ppx_deriving plugins with jbuilder. This work
spanned across multiple repositories and not all parts were released
at the same time in opam. I was away for the past few months so I
couldn’t finish all this properly, and I didn’t leave a detailed plan
of the whole work so that other could finish it. Sorry for the
troubles caused.
At this point, the complex part of the work for being able to use
ppx_deriving plugins with jbuilder has been done and is released.
There are just a few things that every ppx_deriving plugin must do
to ensure it is compatible with jbuilder. Note that plugins that are
developped with jbuilder are automatically compatible with jbuilder
and other build systems. This is only for plugins that are developped
and packaged using other systems (oasis, ocamlbuild, makefiles,
etc…).
Here are what such plugins must ensure:
-
the plugin and in particular the
METAfile must support static
linking.ppx_derivingitself supports both dynamic linking and
static linking of custom ppx drivers, so there should normally be
nothing to change for most plugins -
jbuilder uses a slightly different model for dealing with ppx
rewriters that the original model. The main difference for
ppx_derivingplugins is that runtime dependencies of the rewriter
must be specified explicitely in theMETAfile as follow:ppx_runtime_deps = "foo.runtime ..." -
because jbuilder always statically links plugins inside custom ppx
drivers, you must make sure that the .cma and .cmxa archives of
plugins are linked with the-linkallflag of the OCaml compiler,
otherwise they’ll be ignored by the compiler when linking the
custom ppx driver. For instance if you are using ocamlbuild, you
can add a line like this to your_tagsfile:<src/foo.{cma,cmxa}>: linkall