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/36ad539f-1582-45a2-9e47-851e15cbb780%40googlegroups.com.
