Examples require +weak.js
Kakadu opened this issue · 3 comments
Kakadu commented
I can't run examples because some stuff about weaks and ephemerons are not available (the html file doesn't load and raises exceptions). Where should I put +weak.js
?
➜ incr_dom git:(master) evalopam
4.06.0
/home/kakadu/.opam/4.06.0+fp+flambda/lib/ocaml
➜ incr_dom git:(master) jbuilder build example/text_input/{main.bc.js,index.html}
ppx example/text_input/main.pp.ml
ppx example/text_input/app.pp.ml
ocamldep example/text_input/main.depends.ocamldep-output
ocamlc example/text_input/app.{cmi,cmo,cmt}
ocamlc example/text_input/main.{cmi,cmo,cmt}
ocamlc example/text_input/main.bc
js_of_ocaml example/text_input/main.bc.js
There are some missing primitives
Dummy implementations (raising 'Failure' exception) will be used if they are not available at runtime.
You can prevent the generation of dummy implementations with the commandline option '--disable genprim'
Missing primitives provided by +weak.js:
caml_ephe_create
caml_ephe_get_data
caml_ephe_set_data
caml_ephe_set_key
caml_weak_create
caml_weak_get
caml_weak_set
bcc32 commented
You can add the following to the jbuild
file:
diff --git a/example/text_input/jbuild b/example/text_input/jbuild
index 923dd66..7f3ae7c 100644
--- a/example/text_input/jbuild
+++ b/example/text_input/jbuild
@@ -3,6 +3,7 @@
(flags (:standard -safe-string))
(libraries (incr_dom))
(preprocess (pps (js_of_ocaml-ppx ppx_jane -ite-check ppx_driver.runner)))
+ (js_of_ocaml ((flags (+weak.js))))
))
(jbuild_version 1)
hhugo commented
alternatively, you can use the dev version of js_of_ocaml. It automatically includes weak.js
.
opam pin add js_of_ocaml --dev
hhugo commented
js_of_ocaml has been released. This is fixed