Closed toots closed 8 months ago
Looking at your CI building the js file, I see
(cd _build/default/src/js && /home/opam/.opam/4.14.1/bin/js_of_ocaml -o interactive_js.bc.js filesystem.js interactive_js.bc-for-jsoo)
Warning: your program contains effect handlers; you should probably run js_of_ocaml with option '--enable=effects'
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:
caml_thread_initialize
which indicate you're using ocaml 4.14.1.
Looking at the diff in the PR, I see you're adding a dependency on saturn_lockfree
, which depends on threads.posix
for ocaml < 5. (see https://github.com/ocaml-multicore/saturn/blob/main/src_lockfree/dune).
threads.posix
is not supported by jsoo.
The "4.14.1" path fragment was misleading. I can see the compiler is upgraded to 5.1.1 before. Looking again, saturn_lockfree depends on domain_shims
which unconditionally depends on threads
(see https://gitlab.com/gasche/domain-shims/-/blob/trunk/lib/dune?ref_type=heads).
I think we should somehow remove the threads
dep from domain_shims on ocaml5. (cc @gasche)
Great catch on the threads hard dep, thanks. That fixes it. I'll follow-up there.
We're seeing this error when switching our code to use effects.
Some screenshots:
Here's a link to the compiled file: https://www.dropbox.com/scl/fi/9l8hcrlhk73ue9lx5hys6/interactive_with_effects_js.bc.js?rlkey=58xnqq9hxvnoh76uh0x7k4qjx&dl=0