https://v8.dev/blog/emscripten-llvm-wasm
The jist of it is:
emsdk install latest-upstream
emsdk activate latest-upstream
According to the linked blog, there are code size benefits as well as link time speed-ups.
The faster link time mostly affects application builds.
Of course, you will need to recompile Qt for WebAssembly to use this, and need to configure it with the Qt WebAssembly specific option:
-device-option WASM_OBJECT_FILES=1
After that, you just need to run qmake as normal.
One note: You will need to remove the line
-s \"BINARYEN_TRAP_MODE=\'clamp\'\"
from the mkspecs/wasm-emscripten/qmake.conf, as upstream llvm webassembly backend does it's own overflow clamping and does not support BINARYEN_TRAP_MODE argument.
Hi Lorn,
ReplyDeleteThanks for sharing this. I've been following your work on qt for webassembly, thanks for your tips.
I have had issues with this method. Compared to the "classic method", I have bad behaviour issues in the web browser. The slate application for example, that I built both ways with Qt 5.13.1 (slow then fast). With the slow version, I can access system files and folders with a dialog from the web browser. But with the fast version, when I click on the "open" item of the file menu the app craches telling me in the mozilla console:
"Case insensitive sorting unsupported in the posix collation implementation qtloader.js:382:25
Numeric mode unsupported in the posix collation implementation qtloader.js:382:25"
The latest empscripten version using upstream is 1.39, known to be not compatible with Qt. Is it related ?
Is it a problem of build of my Qt source ? I read somewhere it could be related to bad static linking...
I will write a proper post on the qt forum to share this issue asap.
Best Regards,
Damien
Question also submitted here :
ReplyDeletehttps://forum.qt.io/topic/108225/opening-file-dialog-crashes-app-using-qt-for-web-assembly-and-emsdk-with-upstream-backend