Trying in another VM might show a better stack trace (that handles the promise better). Alternatively, try disabling async compilation so there is no promise (-s WASM_ASYNC_COMPILATION=0).
Once you have a proper stack trace, the issue might be easy to debug. If not, try the sanitizers, https://emscripten.org/docs/debugging/Sanitizers.html as a function signature mismatch is likely undefined behavior or memory corruption. On Fri, Nov 1, 2019 at 12:00 PM Shi Yan <[email protected]> wrote: > Thank you for the tips, I have rebuilt llvm with --profiling, but > unfortunately, the error message is the same: > > RuntimeError: function signature mismatch > RuntimeError: function signature mismatch > > /home/shiy/cib/cib/src/build/clang.js:123 > throw ex; > ^ > abort(RuntimeError: function signature mismatch) at Error > at jsStackTrace (/home/shiy/cib/cib/src/build/clang.js:1748:17) > at stackTrace (/home/shiy/cib/cib/src/build/clang.js:1765:16) > at process.abort (/home/shiy/cib/cib/src/build/clang.js:1556:44) > at process.emit (events.js:209:13) > at processPromiseRejections (internal/process/promises.js:201:33) > at processTicksAndRejections (internal/process/task_queues.js:86:32) > > > > > On Friday, November 1, 2019 at 10:21:08 AM UTC-7, Shi Yan wrote: >> >> I'm trying to compile llvm into wasm, so that I can compile and run c++ >> code directly from the browser. >> >> I'm using another project as a reference: >> https://github.com/tbfleming/cib >> >> This project worked well, but haven't been updated for 2 years. >> >> I'm basically repeating the same, but with llvm9. >> >> >> >> I got llvm compiled into wasm, and I made a simple program to test it. >> (similar to https://github.com/tbfleming/cib/blob/master/src/clang.cpp) >> >> But as soon as I include a clang header: >> >> #include "clang/CodeGen/CodeGenAction.h" >> >> I will see a runtime error >> >> RuntimeError: function signature mismatch >> RuntimeError: function signature mismatch >> >> /home/shiy/cib/cib/src/build/clang.js:1 >> var Module=typeof Module!=="undefined"?Module:{};var >> moduleOverrides={};var key;for(key in >> Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var >> arguments_=[];var thisProgram="./this.program";var >> quit_=function(status,toThrow){throw toThrow};var >> ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var >> ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var >> ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof >> window==="object";ENVIRONMENT_IS_WORKER=typeof >> importScripts==="function";ENVIRONMENT_HAS_NODE=typeof >> process==="object"&&typeof process.versions==="object"&&typeof >> process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(Module["ENVIRONMENT"]){throw >> new Error("Module.ENVIRONMENT has been deprecated. To force the >> environment, use the ENVIRONMENT compile-time option (for example, -s E >> abort(RuntimeError: function signature mismatch) at Error >> at jsStackTrace (/home/shiy/cib/cib/src/build/clang.js:1:25243) >> at stackTrace (/home/shiy/cib/cib/src/build/clang.js:1:25414) >> at process.abort (/home/shiy/cib/cib/src/build/clang.js:1:22376) >> at process.emit (events.js:209:13) >> at processPromiseRejections (internal/process/promises.js:201:33) >> at processTicksAndRejections (internal/process/task_queues.js:86:32) >> >> >> >> the error message says nothing, it doesn't tell me which function has >> mismatched signature and what the signature should be. >> >> I tried >> >> "-s SAFE_HEAP=1" >> "-s ASSERTIONS=1" >> >> when compiling, but they don't give an extra messages. #"-s >> SAFE_HEAP=1" will crash the program at a different place saying memory >> alignment issue. >> >> >> I also tried the node js option node --async-stack-traces ./clang.js >> >> This gives nothing too. >> >> How can I debug this issue? >> >> >> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/23683275-affc-4dab-aaa4-9de80e5a1709%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/23683275-affc-4dab-aaa4-9de80e5a1709%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpR5EjafUWpvwWpR6%2B7HnYF2r1DmxCzMTLaPkp60s4zZVA%40mail.gmail.com.
