There might be a much better way to do this, but this is what I managed. Some notes:
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
-s DEMANGLE_SUPPORT=1
to maybe get better error messages?
Ok, here are some more error messages with -s DEMANGLE_SUPPORT=1
Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this) bernouli.html:1256Module.printErr bernouli.html:1256nullFunc_vi bernouli.js:7138b3 bernouli.js:343115__ZN5boost14checked_deleteINS_16exception_detail10clone_implINS1_10bad_alloc_EEEEEvPT_ bernouli.js:245067__ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_10bad_alloc_EEEE7disposeEv bernouli.js:245131__ZN5boost6detail15sp_counted_base7releaseEv bernouli.js:22533__ZN5boost6detail12shared_countD2Ev bernouli.js:22514__ZN5boost6detail12shared_countD1Ev bernouli.js:22498__ZN5boost10shared_ptrIKNS_16exception_detail10clone_baseEED2Ev bernouli.js:243944__ZN5boost10shared_ptrIKNS_16exception_detail10clone_baseEED1Ev bernouli.js:243546__ZN5boost13exception_ptrD2Ev bernouli.js:244357__ZN5boost13exception_ptrD1Ev bernouli.js:18175dynCall_vi bernouli.js:342794Runtime.dynCall bernouli.js:255callRuntimeCallbacks bernouli.js:1078exitRuntime bernouli.js:1120exit bernouli.js:350164callMain bernouli.js:350080doRun bernouli.js:350133(anonymous function) bernouli.js:350145
Rasmus,
Can you pass the -ffast-math flag to LLVM via emscripten? That disables exceptions but last time I checked allowed Stan to sort of work when compiled with clang++ (although not with g++).
I actually used that flag in the last couple of builds (by mistake, it tagged along during a copy'n'paste of another flag). Since that actually seems to enable exception catching, I'm not completely sure what the result should be...