caml-list - the Caml user's mailing list
 help / color / Atom feed
* [Caml-list] Dune compilation problems using js_of_ocaml with libraries
@ 2019-12-06 21:05 Helmut Brandl
  0 siblings, 0 replies; only message in thread
From: Helmut Brandl @ 2019-12-06 21:05 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 2456 bytes --]

Hello list.

I have a project with various libraries which I compile using dune. One of the executable is a javascript executable (executable under nodejs).

For the javascript executable I encounter the following problem:

- If I build with ‘—profile release’ everything works fine, except that I get a warning that some primitives are missing. But the program works fine i.e. the missing primitives are obviously not used.

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 +dynlink.js:
  caml_add_debug_info
  caml_dynlink_add_primitive
  caml_dynlink_get_current_libs
  caml_dynlink_lookup_symbol
  caml_dynlink_open_lib
  caml_register_code_fragment
Missing primitives provided by +toplevel.js:
  caml_get_section_table
  caml_realloc_global
  caml_reify_bytecode
  caml_static_alloc


- If I build with the default profile (i.e. — profile dev), then starting the program I get the error message

/Users/helmut/myprogs/alba/program/_build/default/ocaml/alba-node/alba_node.bc.js:51209
    runtime.ml_setup_bridges(0);
            ^

TypeError: runtime.ml_setup_bridges is not a function
    at /Users/helmut/myprogs/alba/program/_build/default/ocaml/alba-node/alba_node.bc.js:51209:13
    at Object.<anonymous> (/Users/helmut/myprogs/alba/program/_build/default/ocaml/alba-node/alba_node.bc.js:51243:3)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
    at executeUserCode (internal/bootstrap/node.js:342:17)
    at startExecution (internal/bootstrap/node.js:276:5)

I assume that there is something missing to load the libraries.

Using the release profile is no principal problem, but compile times are much longer than compiling with the development profile.

Does anybody have an idea how to get the build with development profile working? Should I report the problem to another forum?

Thanks for any hints.
Helmut

[-- Attachment #2: Type: text/html, Size: 9367 bytes --]

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello list.<div class=""><br class=""></div><div class="">I have a project with various libraries which I compile using dune. One of the executable is a javascript executable (executable under nodejs).</div><div class=""><br class=""></div><div class="">For the javascript executable I encounter the following problem:</div><div class=""><br class=""></div><div class="">- If I build with ‘—profile release’ everything works fine, except that I get a warning that some primitives are missing. But the program works fine i.e. the missing primitives are obviously not used.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">There are some missing primitives</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Dummy implementations (raising 'Failure' exception) will be used if they are not available at runtime.</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">You can prevent the generation of dummy implementations with the commandline option '--disable genprim'</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Missing primitives provided by +dynlink.js:</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_add_debug_info</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_dynlink_add_primitive</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_dynlink_get_current_libs</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_dynlink_lookup_symbol</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_dynlink_open_lib</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_register_code_fragment</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Missing primitives provided by +toplevel.js:</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_get_section_table</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_realloc_global</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_reify_bytecode</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; caml_static_alloc</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><br class=""></div><div class="">- If I build with the default profile (i.e. — profile dev), then starting the program I get the error message</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">/Users/helmut/myprogs/alba/program/_build/default/ocaml/alba-node/alba_node.bc.js:51209</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; runtime.ml_setup_bridges(0);</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">TypeError: runtime.ml_setup_bridges is not a function</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at /Users/helmut/myprogs/alba/program/_build/default/ocaml/alba-node/alba_node.bc.js:51209:13</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at Object.&lt;anonymous&gt; (/Users/helmut/myprogs/alba/program/_build/default/ocaml/alba-node/alba_node.bc.js:51243:3)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at Module._compile (internal/modules/cjs/loader.js:721:30)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at Module.load (internal/modules/cjs/loader.js:620:32)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at tryModuleLoad (internal/modules/cjs/loader.js:560:12)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at Function.Module._load (internal/modules/cjs/loader.js:552:3)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at executeUserCode (internal/bootstrap/node.js:342:17)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; at startExecution (internal/bootstrap/node.js:276:5)</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">I assume that there is something missing to load the libraries.</div><div class=""><br class=""></div><div class="">Using the release profile is no principal problem, but compile times are much longer than compiling with the development profile.</div><div class=""><br class=""></div><div class="">Does anybody have an idea how to get the build with development profile working? Should I report the problem to another forum?</div><div class=""><br class=""></div><div class="">Thanks for any hints.</div><div class="">Helmut</div></body></html>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 21:05 [Caml-list] Dune compilation problems using js_of_ocaml with libraries Helmut Brandl

caml-list - the Caml user's mailing list

Archives are clonable:
	git clone --mirror http://inbox.vuxu.org/caml-list
	git clone --mirror https://inbox.ocaml.org/caml-list

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.caml-list


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git