From 936abbf453556af8ccf823070f945778ab08ccd4 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 10 Jan 2024 19:49:39 +1100 Subject: [PATCH] Webclient: Set default stack size to 1 MB Newer emscripten versions now only give a 64 KB stack by default (https://github.com/emscripten-core/emscripten/pull/18191) Older emscripten versions gave a 5 MB stack by default, so we can allocate 4 MB more for use by the game itself --- .github/workflows/build_linux32.yml | 9 ++++++--- Makefile | 2 +- readme.md | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_linux32.yml b/.github/workflows/build_linux32.yml index d11624fb3..ce4492550 100644 --- a/.github/workflows/build_linux32.yml +++ b/.github/workflows/build_linux32.yml @@ -11,6 +11,12 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 + - name: Install packages + shell: bash + run: | + sudo dpkg --add-architecture i386 + sudo apt-get -y update + sudo apt-get -y install gcc-multilib libx11-dev:i386 libxi-dev:i386 libgl1-mesa-dev:i386 - name: Compile 32 bit Linux builds shell: bash id: compile @@ -18,9 +24,6 @@ jobs: COMMON_FLAGS: "-O1 -s -fno-stack-protector -fno-math-errno -Qn" NIX32_FLAGS: "-no-pie -fno-pie -m32 -fvisibility=hidden -fcf-protection=none -rdynamic -DCC_BUILD_ICON" run: | - sudo dpkg --add-architecture i386 - sudo apt-get -y update - sudo apt-get -y install gcc-multilib libx11-dev:i386 libxi-dev:i386 libgl1-mesa-dev:i386 LATEST_FLAG=-DCC_COMMIT_SHA=\"$(git rev-parse --short "$GITHUB_SHA")\" cd src diff --git a/Makefile b/Makefile index 2eeef443e..f0f175a38 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ ifeq ($(PLAT),web) CC=emcc OEXT=.html CFLAGS=-g -LDFLAGS=-s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 --js-library src/interop_web.js +LDFLAGS=-s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library src/interop_web.js endif ifeq ($(PLAT),mingw) diff --git a/readme.md b/readme.md index e2282e236..62ce89c59 100644 --- a/readme.md +++ b/readme.md @@ -235,7 +235,7 @@ Install SDL2 port if needed #### Web -```emcc *.c -s ALLOW_MEMORY_GROWTH=1 --js-library interop_web.js``` +```emcc *.c -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library interop_web.js``` The generated javascript file has some issues. [See here for how to fix](doc/compile-fixes.md#webclient-patches)