Hello all,
I’m stuck with a js_of_ocaml compilation problem. I’ve spent a lot of time to try to understand the problem by my self but did not managed to solve it. Any help would be greatly appreciated!
Here is my problem:
It concerns some code I did not write myself. This code uses js_of_ocaml to build a GUI that interacts with a server process, which launches itself some other processes. The code used to build (and execute) finely with “thread” tag in ocamlbuild command, using js_of_ocaml and js_of_ocaml-lwt 3.0.2.
I recently had to upgrade to OCaml 4.10.0 and js_of_caml 3.5.3, and now, at compilation, “some primitives are missing”:
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_mutex_new
caml_thread_initialize
On the client side, here are the “lwt modules” that are used:
Js_of_ocaml_lwt.Lwt_js (sleep)
Js_of_ocaml_lwt.XmlHttpRequest
Lwt (async, ignore_result)
Again, I would appreciate any help to understand and solve that problem.
I’m not very familiar with ocamlbuild, but I think you should try to remove the threads tag from the rule that produces the bytecode from the .ml sources, not from the rule that produces the js from bytecode.
You can look in the build log _build/_log to find out if the threads library is being linked in or not to the bytecode.
Thanks,
indeed, I also tried to remove thread tag for %.byte objective and it did not work.
I’ll have a look at ocamlbuild log (I’m not familiar with ocamlbuild neither), and maybe I’ll just try to move to dune to see whether it changes something.
Thanks again,
Update: I took time to move the compilation to dune.
Unfortunately, the result is now that there is no error at compilation time, but the problem persists: at runtime the js console outputs:
uncaught exception: 0,248,Failure,-3,caml_thread_initialize not implemented