emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.62k stars 3.28k forks source link

I have some problems when I use it #9319

Closed 382303784 closed 5 years ago

382303784 commented 5 years ago

...
[ 97%] Linking CXX executable bin/wasm-opt
[ 98%] Linking CXX executable bin/wasm2js
[ 98%] Built target wasm-opt
[ 98%] Built target wasm2js
[ 99%] Linking CXX executable bin/asm2wasm
[100%] Linking CXX shared library lib/libbinaryen.so
[100%] Built target asm2wasm
[100%] Built target binaryen
cache:INFO:  - ok
cache:INFO: generating system library: libc.bc... (this will be cached in "/root/.emscripten_cache/asmjs/libc.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libcompiler_rt.bc... (this will be cached in "/root/.emscripten_cache/asmjs/libcompiler_rt.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc-wasm.bc... (this will be cached in "/root/.emscripten_cache/asmjs/libc-wasm.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libdlmalloc.bc... (this will be cached in "/root/.emscripten_cache/asmjs/libdlmalloc.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libpthreads_stub.bc... (this will be cached in "/root/.emscripten_cache/asmjs/libpthreads_stub.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "/root/.emscripten_cache/asmjs/generated_struct_info.json" for subsequent builds)
cache:INFO:  - ok
error: failure to execute js library "library_exceptions.js": SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode,
error: use -s VERBOSE to see more details
Internal compiler error in src/compiler.js!
Please create a bug report at https://github.com/emscripten-core/emscripten/issues/ with a log of the build and the input files used to run. Exception message: "SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode" | SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at Object.LibraryManager.load (eval at globalEval (/home/wgy/emscripten/src/compiler.js:110:8), <anonymous>:176:14)
    at JSify (eval at globalEval (/home/wgy/emscripten/src/compiler.js:110:8), <anonymous>:69:20)
    at Object.<anonymous> (/home/wgy/emscripten/src/compiler.js:220:3)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3
shared:ERROR: '/usr/bin/nodejs /home/wgy/emscripten/src/compiler.js /tmp/tmpEu45bt.txt /home/wgy/emscripten/src/library_pthread_stub.js' failed (1)
CMakeFiles/argon2.dir/build.make:258: recipe for target 'generated/argon2.js' failed
make[2]: *** [generated/argon2.js] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/argon2.dir/all' failed
make[1]: *** [CMakeFiles/argon2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
mv: cannot stat 'generated/argon2.js': No such file or directory
base64: generated/argon2.wasm: No such file or directory
Done
sbc100 commented 5 years ago

Looks like this must be related to #9265.

Can you shoe the full command that fails here. You can with do this by running make VERBOSE=1 of my switching your cmake build to use ninja with -G Ninja (ninja defaults to showing the failing command when a command fails).

sbc100 commented 5 years ago

Actually it looks like this might be an old version of node. What version are you running? (what does /usr/bin/nodejs --version say?)

kripken commented 5 years ago

This does seem to be because of an older version of node. But looks like it's a regression where we added code with let in our compiler.js code. Fix in #9324

382303784 commented 5 years ago

Actually it looks like this might be an old version of node. What version are you running? (what does /usr/bin/nodejs --version say?)

Yes, I made a mistake in my node version. Now it is ready to use, thank you.