Looks to me like that opencv library has been compiled with threading support.
Threading on WASM comes with all sorts of unfortunate caveats. Even if the browser's WASM engine supports threading in general, the feature is locked behind specific HTTP response headers (so apart from requiring a supported browser you also need control over the web server's configuration, e.g. just using one of the popular cloud hosting services may or may not work).
Hi, I have a cpp program which uses opencv modules and I have successfully compiled it to webassembly using emscripten. It works very well on chrome in my macbook. However when I tried to load the page through localhost in my phone using android chrome it threw the following error.Uncaught (in promise) RuntimeError: abort(CompileError: WebAssembly.instantiate(): Compiling function #21 failed: Invalid opcode 0xfe (enable with --experimental-wasm-threads) @+5378). Build with -s ASSERTIONS=1 for more info.
So I tried to figure out what was causing this and understood that it only happens after I have used a static library from opencv to build my wasm app using the following command.
emcc -O3 -o hello.js -s -I/Users/user1/MyDocuments/work/new/emscripten_playground/playground libopencv_core.a hello.cpp -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' -s SINGLE_FILE=1
if I take out the libopencv_core.a and remove the lines that use stuff from that module, the wasm loads without any warnings in the android chrome.
But I need to use those modules.
Please tell me if you got any idea about how to solve this problem.
Also if I enable the experimental webassembly flag in the android chrome it works without any problems. But I don't think I can do that through code so I need to find a way to fix this without the experimental flag. There has to be a way because opencv.js(wasm embedded) that is available from the opencv documentation runs without any errors on the android chrome .