# Jbuilder and ppx: see generated code

**URL:** <https://discuss.ocaml.org/t/jbuilder-and-ppx-see-generated-code/717>\
**Category:** Ecosystem\
**Tags:** jbuilder\
**Created:** [August 14, 2017, 8:05pm UTC](https://discuss.ocaml.org/t/jbuilder-and-ppx-see-generated-code/717 "2017-08-14T20:05:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannywillems](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dannywillems/32/2108_2.png) [@dannywillems](https://discuss.ocaml.org/u/dannywillems)\
**Post date:** [August 14, 2017, 8:05pm UTC](https://discuss.ocaml.org/t/jbuilder-and-ppx-see-generated-code/717/1 "2017-08-14T20:05:30Z")

</div>

Hi everyone.

Could someone tell me how I can see the generated code when I use jbuilder and PPX? And in general (with ocamlc/ocamlopt), which arguments could I use to see the generated code?

Thanks.

Danny.

---

<div class="post-metadata">

**Author:** ![dinosaure](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dinosaure/32/16_2.png) [@dinosaure](https://discuss.ocaml.org/u/dinosaure)\
**Post date:** [August 14, 2017, 8:21pm UTC](https://discuss.ocaml.org/t/jbuilder-and-ppx-see-generated-code/717/2 "2017-08-14T20:21:15Z")

</div>

The `-dsource` argument for `ocamlc`/`ocamlopt` shows you the generated code by the PPX like:

```ocaml
type t = int [@@deriving show]

```

and

```auto
$ ocamlfind ocamlc -dsource -linkall -linkpkg -package ppx_deriving,ppx_deriving.show,ppx_deriving.runtime main.ml
type t = int[@@deriving show]
let rec (pp : Format.formatter -> t -> Ppx_deriving_runtime.unit) =
  ((let open! Ppx_deriving_runtime in fun fmt -> Format.fprintf fmt "%d")
  [@ocaml.warning "-A"])

and show : t -> Ppx_deriving_runtime.string =
  fun x -> Format.asprintf "%a" pp x

```

But I don’t know for `jbuilder` - which you can use my advise in the `_build` directory.

---

<div class="post-metadata">

**Author:** ![jjb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jjb/32/2713_2.png) [@jjb](https://discuss.ocaml.org/u/jjb)\
**Post date:** [August 14, 2017, 9:36pm UTC](https://discuss.ocaml.org/t/jbuilder-and-ppx-see-generated-code/717/3 "2017-08-14T21:36:25Z")

</div>

Look in \_build/log for the command that invokes ppx.exe on the source file you are interested in. If you remove the `--dump-ast` option, the output file will be human-readable instead of binary.

---

<div class="post-metadata">

**Author:** ![dannywillems](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dannywillems/32/2108_2.png) [@dannywillems](https://discuss.ocaml.org/u/dannywillems)\
**Post date:** [August 15, 2017, 7:34am UTC](https://discuss.ocaml.org/t/jbuilder-and-ppx-see-generated-code/717/4 "2017-08-15T07:34:13Z")

</div>

Mixing @jjb and @dinosaure solutions works. Thanks.

It could be interesting to have something in jbuilder directly to do the job.
