Application exit (ReferenceError: SharedArrayBuffer is not defined)
Unsolved
Qt for WebAssembly
-
wrote on 11 Sept 2023, 15:23 last edited by CKurdu 9 Nov 2023, 16:46
Hello everybody,
My webassembly based Qt app works expected from Qt Creator but When I deployed the to my http server, it gave me the below error.
Settings are
Qt 6.5.2(multi-threadd)
emscripten version : 3.1.25
Development Machine OS: Windows 11Application exit (ReferenceError: SharedArrayBuffer is not defined)
I think the problem is related to web worker or threads. Some security problems. Not sure.
from the developer console, it gave this output.
ReferenceError: SharedArrayBuffer is not defined at eval (eval at completeLoadEmscriptenModule (qtloader.js:461:9), <anonymous>:9:8417) at completeLoadEmscriptenModule (qtloader.js:462:9) at qtloader.js:345:13
When I compile the same project with a single thread, it works as expected from an HTTP server.
Kind Regards -
wrote on 15 Sept 2023, 03:14 last edited by JasonWong
You need to modify the http header. If you are using nginx deployment, you need to modify the conf file.
This header needs to be modified:
add_header 'Cross-Origin-Embedder-Policy' 'require-corp'; add_header 'Cross-Origin-Opener-Policy' 'same-origin';
2/2