为 Qt WebAssembly 编译虚拟键盘

Compile Virtual Keyboard for Qt WebAssembly

我正在尝试编译 QtCreatorWebAssembly 的虚拟键盘项目示例。

编译 wasm 库必须静态链接。根据 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.

这么说,我正在尝试用

编译
mkdir buildwasm && cd buildwasm
/opt/Qt/5.15.2/wasm_32/bin/qmake .. CONFIG+=static CONFIG+=disable-hunspell && make -j8

但是键盘不是静态链接的,我收到这个错误

wasm-ld: error: initial memory too small, 18699856 bytes needed
shared:ERROR: ...

我是不是遗漏了什么或者是某种错误?

您可以使用 -s TOTAL_MEMORY=32MB 编译器标志在 emcc link 时预设一个大小。 相关问题:wasm-ld: error: initial memory too small, 18317952 bytes needed

有一个默认限制设置,设置为:16777216 https://github.com/emscripten-core/emscripten/blob/master/src/settings.js#L171