I'm trying to compile the virtual keyboard project example from QtCreator
in WebAssembly
.
To compile for wasm library have to be linked statically. According to the docs:
Static builds
The virtual keyboard can be built and linked statically against the application. This implies that Qt is also built statically (using the -static option in the configure command line).
Static builds of the virtual keyboard are enabled by adding CONFIG+=static to the qmake command line and then rebuilding.
Some third party modules used by the virtual keyboard are always built as shared libraries. These modules are Hunspell and Lipi Toolkit.
Said so, I'm trying to compile with
mkdir buildwasm && cd buildwasm
/opt/Qt/5.15.2/wasm_32/bin/qmake .. CONFIG+=static CONFIG+=disable-hunspell && make -j8
But somehow keyboard is not statically linked and I receive this error
wasm-ld: error: initial memory too small, 18699856 bytes needed
shared:ERROR: ...
am I missing something or it's a kind of a bug?
You can use -s TOTAL_MEMORY=32MB
compiler flag to preset a size at emcc link time.
Related question: wasm-ld: error: initial memory too small, 18317952 bytes needed
There is a default limit setting, set to: 16777216 https://github.com/emscripten-core/emscripten/blob/master/src/settings.js#L171