BindingError: emval::as has unknown type j
-
I get this error in my browser when the .wasm file is loading, causing it to fail to load.
(Qt 6.9.3 + emsdk 3.1.70 + qmake)
Through lots of trial and error, I figured out that it's happening when using emscripten::val, or maybe EM_JS, in a .cpp file that is located in a subfolder (relative to the .pro file). Moving the file up to the main directory yields a wasm file that works normally.
Has anyone seen this and have any more details on what's causing it and what is a better fix than moving the file? My .pro file is pretty basic and I don't see any reason the location of the file should matter.
-
Try an unoptimized build first (without optimizations) to verify a code folding/LTO issue, and if so, update emsdk to a newer version; if you don't feel like messing with it, moving the file is the quick fix.
-
I did a debug build and got a more helpful stacktrace. It turns out that the problem was due to using QDateTime::fromString to initialize a static variable. It was erroring on using QLocale(). I simply moved the initialization to later in the program startup and now it works. Evidentially the file location wasn't actually relevant but must have had some incidental effect on how things got compiled that caused things to initialize in a different order.
-
M Matthew Daskilewicz has marked this topic as solved