From 2148e1f0e6026ad7a87c7eec0362d1250c1f09e9 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 19 Oct 2021 16:03:21 +1000 Subject: [PATCH] wasm: increase default initial memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some apps may need more initial memory when linking, emscripten will fail with: wasm-ld: error: initial memory too small This increases the default initial memory form 16MB to 20MB. Larger apps might still get this error, in which case QT_WASM_INITIAL_MEMORY can be set. Pick-to: 6.2 Fixes: QTBUG-97457 Change-Id: Icdc56c41fb3a3852a9a83f7a3dc15820e83e1148 Reviewed-by: Morten Johan Sørvig --- cmake/QtWasmHelpers.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake index 592db0d0db1..ca6cadff939 100644 --- a/cmake/QtWasmHelpers.cmake +++ b/cmake/QtWasmHelpers.cmake @@ -28,8 +28,12 @@ function (qt_internal_setup_wasm_target_properties wasmTarget) # (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size # at build time. Further, browsers limit the maximum initial memory size to 1GB. # QT_WASM_INITIAL_MEMORY must be a multiple of 64KB (i.e. 65536) - if(NOT DEFINED QT_WASM_INITIAL_MEMORY AND QT_FEATURE_thread) - set(QT_WASM_INITIAL_MEMORY "1GB") + if(NOT DEFINED QT_WASM_INITIAL_MEMORY) + if(QT_FEATURE_thread) + set(QT_WASM_INITIAL_MEMORY "1GB") + else() + set(QT_WASM_INITIAL_MEMORY "20MB") # emscripten default is 16MB, we need slightly more sometimes + endif() endif() if(DEFINED QT_WASM_INITIAL_MEMORY)