$ cat x.ml
type t = int [@@deriving sexp]
let int_pair_of_sexp = [%of_sexp: int * int ]
$ cat jbuild
(jbuild_version 1)
(library (
(name foo)
(preprocess (pps (ppx_jane)))
))
$ jbuilder build foo.cma
ocamlopt default/ppx_jane/ppx.exe [.ppx]
ppx x.pp.ml
ocamldep foo.depends.ocamldep-output
ocamlc foo.{cmi,cmo,cmt}
ocamlc foo__X.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /Users/ashish/.opam/4.03.0/bin/ocamlc.opt -w -40 -g -bin-annot -no-alias-deps -I . -open Foo -o foo__X.cmo -c -impl x.pp.ml)
File "x.ml", line 2, characters 25-32:
Uninterpreted extension 'of_sexp'.
The deriving annotation on line 1 is working, so I got something right. What am I doing wrong that makes line 2 fail.
Seems like this is an issue with ppx_jane
rather than jbuilder. ppx_sexp_conv
works just fine.
And I can observe the same difference in behavior in utop as well.
I’m getting the opposite: it works in utop after loading ppx_jane, and using ppx_sexp_conv in jbuild causes the same error.
I have ppx_jane 113.33.00 and ppx_sexp_conv 113.33.01+4.03.
dkim
June 2, 2017, 3:14pm
4
You’re supposed to open Sexplib.Std
(or open Core
if you use Core) at the beginning of x.ml
. ppx_sexp_conv
requires that a set of sexp converters for basic values (e.g., int_of_sexp
) should already be in scope.
Right, but that’s a different error. The extension isn’t even getting processed.
dkim
June 2, 2017, 3:43pm
6
That’s strange. Once I add open Sexplib.Std
, jbuilder successfully finishes building foo.cma
on my machine:
$ opam show --field=version jbuilder
1.0+beta9
$ opam show --field=version ppx_jane
v0.9.0
$ opam show --field=version ppx_sexp_conv
v0.9.0
$ ls
jbuild x.ml
$ cat x.ml
open Sexplib.Std
type t = int [@@deriving sexp]
let int_pair_of_sexp = [%of_sexp: int * int ]
$ cat jbuild
(jbuild_version 1)
(library (
(name foo)
(preprocess (pps (ppx_jane)))
))
$ jbuilder build foo.cma
ocamlopt .ppx/ppx_jane/ppx.exe
ppx x.pp.ml
ocamldep foo.depends.ocamldep-output
ocamlc foo.{cmi,cmo,cmt}
ocamlc foo__X.{cmi,cmo,cmt}
ocamlc foo.cma
$ ls _build/default/
foo.cma foo.requires.sexp
foo.cmi foo__X.cmi
foo.cmo foo__X.cmo
foo.cmt foo__X.cmt
foo.depends.ocamldep-output x.ml
foo.ml-gen x.pp.ml
Okay, but without open Sexplib.Std
, you must have been getting a different error than the one I’m reporting.
That might be the problem. I just updated to ppx_jane v0.9 and it seems to be working now.
Yes, that resolves it for me too.