Ocaml 如何在ppx_派生中使用jbuild和ppx_驱动程序

Ocaml 如何在ppx_派生中使用jbuild和ppx_驱动程序,ocaml,ppx,Ocaml,Ppx,我正试图与(ppx\u-deriving\u-yojson特别地)一起使用,但现在被卡住了一个多小时。我目前的方法是一个jbuild文件,包含以下内容: (jbuild_version 1) (executables ((names (my-binary)) (libraries (ppx_deriving ppx_deriving_yojson cohttp yojson)) (preprocess (pps (ppx_deriving_yojson ppx_driver.run

我正试图与(
ppx\u-deriving\u-yojson
特别地)一起使用,但现在被卡住了一个多小时。我目前的方法是一个
jbuild
文件,包含以下内容:

(jbuild_version 1)
(executables
((names (my-binary))
(libraries
 (ppx_deriving
  ppx_deriving_yojson
  cohttp
  yojson))
(preprocess (pps (ppx_deriving_yojson ppx_driver.runner)))))
但这会导致

Command [5] exited with code 1:
$ (cd _build/default && ../.ppx/default/ppx_deriving_yojson+ppx_driver.runner/ppx.exe --dump-ast -o src/my_file.pp.ml --impl src/my_file.ml)
File "src/my_file.ml", line 16, characters 5-13:
Error: Attribute `deriving' was not used
\u build/.ppx/default/ppx\u deriving\u yojson+ppx\u driver.runner/ppx.exe中运行生成的
ppx\u驱动程序
,并使用
-print transformations
手动执行,会产生空输出,因此我显然遗漏了一些内容


通过将
ppx_派生
ppx_派生
作为依赖项,代码可以与
topkg
完美结合。

对于ppx_派生 代码:

和一个示例
jbuild
文件:

(jbuild_version 1)

(executables
 ((names (main))
  (preprocess (pps (ppx_deriving_yojson)))
  (libraries (ppx_deriving_yojson.runtime))))

(install
 ((section bin)
  (files ((main.exe as main)))))

您使用的是什么版本的ppx_派生+ppx_派生?jbuilder将只使用基于ocaml migrate parsetree的ppx,并且尚未向opam发布基于ocaml migrate parsetree的ppx_派生。
(jbuild_version 1)

(executables
 ((names (main))
  (preprocess (pps (ppx_deriving_yojson)))
  (libraries (ppx_deriving_yojson.runtime))))

(install
 ((section bin)
  (files ((main.exe as main)))))