ppx_jane+ppx_driver.runner error: unknown option '-embed-errors'
I'm using jbuilder 1.0+beta3. I'm trying to use ppx_jane, because I'm using [@@deriving sexp] for one of my type, but I can't really make jbuilder work with it. jbuild file:
(jbuild_version 1)
(executables
((names (myparsing))
(libraries (core))
(preprocess (pps (ppx_jane ppx_driver.runner)))
))
jbuilder log:
# jbuilder build myparsing.exe
$ /home/stryker/.opam/system/bin/ocamlfind printconf path > /tmp/jbuild743bf3.output
$ /usr/bin/ocamlc.opt -config > /tmp/jbuild78e625.output
> Warning: discarding value of variable "color" in OCAMLPARAM
$ /usr/bin/opam config var lib > /tmp/jbuildbed18f.output
# Jbuilder context:
# ((name default)
# (kind default)
# (merlin true)
# (for_host ())
# (build_dir _build/default)
# (toplevel_path (/home/stryker/.opam/system/lib/toplevel))
# (ocaml_bin /usr/bin)
# (ocaml /usr/bin/ocaml)
# (ocamlc /usr/bin/ocamlc.opt)
# (ocamlopt (/usr/bin/ocamlopt.opt))
# (ocamldep /usr/bin/ocamldep.opt)
# (ocamllex /usr/bin/ocamllex.opt)
# (ocamlyacc /usr/bin/ocamlyacc)
# (ocamlmklib /usr/bin/ocamlmklib)
# (env ())
# (findlib_path (/home/stryker/.opam/system/lib))
# (arch_sixtyfour true)
# (natdynlink_supported true)
# (opam_vars ((lib /home/stryker/.opam/system/lib)))
# (ocamlc_config
# ((architecture amd64)
# (asm as)
# (asm_cfi_supported true)
# (ast_impl_magic_number Caml1999M016)
# (ast_intf_magic_number Caml1999N015)
# (bytecomp_c_compiler
# "gcc -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O -fPIC")
# (bytecomp_c_libraries "-lm -ldl -lcurses -lpthread")
# (cc_profile -pg)
# (ccomp_type cc)
# (cma_magic_number Caml1999A011)
# (cmi_magic_number Caml1999I017)
# (cmo_magic_number Caml1999O010)
# (cmt_magic_number Caml2012T004)
# (cmx_magic_number Caml1999Y014)
# (cmxa_magic_number Caml1999Z013)
# (cmxs_magic_number Caml2007D002)
# (default_executable_name a.out)
# (exec_magic_number Caml1999X011)
# (ext_asm .s)
# (ext_dll .so)
# (ext_lib .a)
# (ext_obj .o)
# (host x86_64-pc-linux-gnu)
# (model default)
# (native_c_compiler "gcc -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT")
# (native_c_libraries "-lm -ldl")
# (native_pack_linker "ld -r --hash-style=both --as-needed --build-id -o ")
# (os_type Unix)
# (ranlib ranlib)
# (standard_library /usr/lib/ocaml)
# (standard_library_default /usr/lib/ocaml)
# (standard_runtime /usr/bin/ocamlrun)
# (system linux)
# (systhread_supported true)
# (target x86_64-pc-linux-gnu)
# (version 4.02.3)
# (with_frame_pointers false)))
# (which
# ((ocamlc (/usr/bin/ocamlc.opt))
# (ocamlfind (/home/stryker/.opam/system/bin/ocamlfind)))))
$ (cd _build/default && ../.ppx/default/ppx_jane+ppx_driver.runner/ppx.exe -dirname . -inline-test-drop-with-deadcode -bench-drop-with-deadcode -embed-errors false --dump-ast -o myparsing.pp.ml --impl myparsing.ml)
> ../.ppx/default/ppx_jane+ppx_driver.runner/ppx.exe: unknown option '-embed-errors'.
> ppx.exe [extra_args] [<files>]
> -dirname <dir> Name of the current directory relative to the root of the project
> -inline-test-lib A base name to use for generated identifiers (has to be globally unique in a program).ppx_inline_test (and ppx_bench) are disabled unless this flag is passed.
> -inline-test-drop Drop unit tests
> -inline-test-drop-with-deadcode Drop unit tests by wrapping them inside deadcode to prevent unused variable warnings.
> -bench-drop Drop inline benchmarks
> -bench-drop-with-deadcode Drop inline benchmarks by wrapping them inside deadcode to prevent unused variable warnings.
> -as-ppx Run as a -ppx rewriter (must be the first argument)
> -o <filename> Output file (use '-' for stdout)
> -reserve-namespace <string> Mark the given namespace as reserved
> -loc-filename <string> File name to use in locations
> -no-optcomp Do not use optcomp
> -dump-ast Dump the marshaled ast to the output file instead of pretty-printing it
> -dparsetree Print the parsetree (same as ocamlc -dparsetree)
> -impl <file> Treat the input as a .ml file
> -intf <file> Treat the input as a .mli file
> -no-check Disable checks (unsafe)
> -debug-attribute-drop Debug attribute dropping
> -print-transformations Print linked-in code transformations, in the order they are applied
> -apply <names> Apply these transformations in order (comma-separated list)
> -help Display this list of options
> --help Display this list of options
[2]
https://github.com/janestreet/ppx_driver/blob/master/README.md#using-ppx_driver-based-rewriters
note: have to remove the 'ppx_driver.runner' otherwise similar error as yours.
Without ppx_driver.runner I get an unknown option '-dirname'. jbuild file:
(jbuild_version 1)
(executables
((names (myparsing))
(libraries (core))
(preprocess (pps (ppx_jane)))
))
jbuilder log:
# jbuilder build myparsing.exe
$ /home/stryker/.opam/system/bin/ocamlfind printconf path > /tmp/jbuild23aaa5.output
$ /usr/bin/ocamlc.opt -config > /tmp/jbuilda93b48.output
> Warning: discarding value of variable "color" in OCAMLPARAM
$ /usr/bin/opam config var lib > /tmp/jbuildfac84d.output
# Jbuilder context:
# ((name default)
# (kind default)
# (merlin true)
# (for_host ())
# (build_dir _build/default)
# (toplevel_path (/home/stryker/.opam/system/lib/toplevel))
# (ocaml_bin /usr/bin)
# (ocaml /usr/bin/ocaml)
# (ocamlc /usr/bin/ocamlc.opt)
# (ocamlopt (/usr/bin/ocamlopt.opt))
# (ocamldep /usr/bin/ocamldep.opt)
# (ocamllex /usr/bin/ocamllex.opt)
# (ocamlyacc /usr/bin/ocamlyacc)
# (ocamlmklib /usr/bin/ocamlmklib)
# (env ())
# (findlib_path (/home/stryker/.opam/system/lib))
# (arch_sixtyfour true)
# (natdynlink_supported true)
# (opam_vars ((lib /home/stryker/.opam/system/lib)))
# (ocamlc_config
# ((architecture amd64)
# (asm as)
# (asm_cfi_supported true)
# (ast_impl_magic_number Caml1999M016)
# (ast_intf_magic_number Caml1999N015)
# (bytecomp_c_compiler
# "gcc -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O -fPIC")
# (bytecomp_c_libraries "-lm -ldl -lcurses -lpthread")
# (cc_profile -pg)
# (ccomp_type cc)
# (cma_magic_number Caml1999A011)
# (cmi_magic_number Caml1999I017)
# (cmo_magic_number Caml1999O010)
# (cmt_magic_number Caml2012T004)
# (cmx_magic_number Caml1999Y014)
# (cmxa_magic_number Caml1999Z013)
# (cmxs_magic_number Caml2007D002)
# (default_executable_name a.out)
# (exec_magic_number Caml1999X011)
# (ext_asm .s)
# (ext_dll .so)
# (ext_lib .a)
# (ext_obj .o)
# (host x86_64-pc-linux-gnu)
# (model default)
# (native_c_compiler "gcc -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT")
# (native_c_libraries "-lm -ldl")
# (native_pack_linker "ld -r --hash-style=both --as-needed --build-id -o ")
# (os_type Unix)
# (ranlib ranlib)
# (standard_library /usr/lib/ocaml)
# (standard_library_default /usr/lib/ocaml)
# (standard_runtime /usr/bin/ocamlrun)
# (system linux)
# (systhread_supported true)
# (target x86_64-pc-linux-gnu)
# (version 4.02.3)
# (with_frame_pointers false)))
# (which
# ((ocamlc (/usr/bin/ocamlc.opt))
# (ocamlfind (/home/stryker/.opam/system/bin/ocamlfind)))))
$ (cd _build/default && ../.ppx/default/ppx_jane/ppx.exe -dirname . -inline-test-drop-with-deadcode -bench-drop-with-deadcode --dump-ast -o myparsing.pp.ml --impl myparsing.ml)
> ../.ppx/default/ppx_jane/ppx.exe: unknown option '-dirname'.
> ppx.exe [options] [<files>]
> --as-ppx Act as a -ppx rewriter
> --dump-ast Output a binary AST instead of source code
> -o FILE Output to this file instead of the standard output
> --intf FILE Treat FILE as a .mli file
> --impl FILE Treat FILE as a .ml file
> --cookie NAME=EXPR Set the cookie NAME to EXPR
> -help Display this list of options
> --help Display this list of options
[2]
My code compiles with corebuild myparsing.native, so the code should be fine.
Do you have the janestreet opam repository pinned? I think jbuilder only supports the yet to be released ppx extensions from janestreet. That is unless you want to cook up your own ppx rewriting commands with ocamlfind.
Thx, that worked with the ppx_driver one. I just added the janestreet repo with opam repo add janestreet-bleeding https://ocaml.janestreet.com/opam-repository and it worked.