hi-ogawa / Stockfish

stockfish-nnue.wasm
https://stockfish-nnue-wasm.vercel.app
GNU General Public License v3.0
97 stars 11 forks source link

Confusion about files the build process should output #6

Closed edelah closed 3 years ago

edelah commented 3 years ago

I ran "make build -j 4 wasm_simd_post_mvp=yes" and got 1 output file named "stockfish".

When I run : node --experimental-wasm-{simd,threads} --experimental-repl-await --wasm-simd-post-mvp

const sf = await require("./stockfish")();

I got an error message: "ELF ^

Uncaught SyntaxError: Invalid or unexpected token"

I think the build should have output 3 files: stockfish, stockfish.js and stockfish.wasm. Am I right?

context: -node: v14.15.5 -v8: 8.4.371.19-node.18 -Linux 5.4.72-microsoft-standard-WSL2 x86_64

hi-ogawa commented 3 years ago

Hi edelarh, thanks for the interest in building stockfish nnue wasm. Regarding the error you got, I think that's due to the incorrect build command you're using. As written in https://github.com/hi-ogawa/Stockfish/blob/emscripten/src/emscripten/README.md, the correct one would be

make -C src emscripten_build ARCH=wasm wasm_simd_post_mvp=yes

Please let me know if this solves your issue.

edelah commented 3 years ago

It solved my issue but I got an error when I run this code.

$ node --experimental-wasm-{simd,threads} --experimental-repl-await --wasm-simd-post-mvp Welcome to Node.js v15.8.0. Type ".help" for more information. > const sf = await require("./stockfish")(); undefined > pthread sent an error! undefined:undefined: self is not defined

hi-ogawa commented 3 years ago

Would you try the example on README.md? That is

node --experimental-wasm-{simd,threads} --wasm-simd-post-mvp src/emscripten/public/uci.js

This command should give you the standard UCI console.

edelah commented 3 years ago

node --experimental-wasm-{simd,threads} --wasm-simd-post-mvp src/emscripten/public/uci.js is working as expected.

I will adapt uci.js to my needs.

Thanks.

hi-ogawa commented 3 years ago

Great, I'm glad to know it worked. I'll close this issue, but feel free to open a new one if you find some issue. Thanks!