Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiling with separate jsoo mode #62

Open
L-as opened this issue Jun 29, 2023 · 5 comments
Open

Fix compiling with separate jsoo mode #62

L-as opened this issue Jun 29, 2023 · 5 comments

Comments

@L-as
Copy link
Contributor

L-as commented Jun 29, 2023

It's much faster, but when I try to use it I get this error with a snarkyjs only modified at parts unrelated to this (AFAICT, might be wrong):

[user@nixos:/work/mina/src/lib/snarkyjs/dist/node]$ node
Welcome to Node.js v19.8.1.
Type ".help" for more information.
> snarkyjs = await import("./snarky.js");
/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:8603
         throw err;
         ^

Error
    at caml_raise_with_string (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:849:63)
    at caml_failwith (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:1326:7)
    at caml_int_of_string (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:6325:29)
    at /work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:802660:24
    at /work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:802666:8
    at Object.<anonymous> (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:804154:3)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)

Node.js v19.8.1
@mitschabaude
Copy link
Contributor

could you show the stack trace when running a script with node --enable-source-maps? this one doesn't help

@L-as
Copy link
Contributor Author

L-as commented Jun 29, 2023

@mitschabaude

[user@nixos:/work/mina/src/lib/snarkyjs/dist/node]$ node --enable-source-maps snarky.js
/workspace_root/src/lib/snarkyjs/src/bindings/ocaml/overrides.js:34
    if (err instanceof Error) throw err;
                              ^


Error
    at caml_raise_with_string (/workspace_root/src/lib/snarkyjs/src/bindings/ocaml/overrides.js:6:9)
    at caml_failwith (/builtin/+fail.js:43:3)
    at caml_int_of_string (/builtin/+ints.js:72:27)
    at <anonymous> (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.map:0:0)
    at <anonymous> (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.map:0:0)
    at Object.<anonymous> (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.map:0:0)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)

Node.js v19.8.1

It doesn't really say anything more. I looked at the compiled output, and at some point there is var ..., _s_ = { ..., "port":"" }, and changing the port to "0" instead makes everything work. I am not sure what the code comes from and why it's affected by this.

@L-as
Copy link
Contributor Author

L-as commented Jun 29, 2023

@mitschabaude Does it work for you locally?

@L-as
Copy link
Contributor Author

L-as commented Aug 15, 2023

I've added this as a (horrible) work-around to the end of build-snarkyjs-node-artifacts.sh

sed -i 's/"port":""/"port":"0"/' "$BINDINGS_PATH"/snarky_js_node.bc.cjs

@mitschabaude
Copy link
Contributor

Weird stuff! Sorry didn't try locally

A while ago we used separate compilation by default, for the released version of snarkyjs. Moved away from it to get smaller JSOO bundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants