From d01372ce545b82bfd293176265ab08b7e8f229b4 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Fri, 21 Oct 2022 21:07:51 +0100 Subject: [PATCH] Workaround Emscripten CMake issue -fexceptions causes some issues: https://github.com/emscripten-core/emscripten/issues/18084 After trial and error it seems that moving them to apply only to C++ (via CXXFLAGS) works best. --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 886bcc53e..8f3b0aecb 100755 --- a/build.sh +++ b/build.sh @@ -98,7 +98,7 @@ if [ "$PIC" = "true" ]; then PIC_FLAG=--pic; fi #export LDFLAGS+=" --source-map-base http://localhost:3000/lib/" # Common compiler flags -export CFLAGS="-O3 -fno-rtti -fexceptions -mnontrapping-fptoint -pthread" +export CFLAGS="-O3 -fno-rtti -mnontrapping-fptoint -pthread" if [ "$SIMD" = "true" ]; then export CFLAGS+=" -msimd128 -DWASM_SIMD_COMPAT_SLOW"; fi if [ "$WASM_BIGINT" = "true" ]; then # libffi needs to detect WASM_BIGINT support at compile time @@ -108,7 +108,7 @@ if [ "$WASM_FS" = "true" ]; then export CFLAGS+=" -DWASMFS"; fi if [ "$WASM_EH" = "true" ]; then export CFLAGS+=" -sSUPPORT_LONGJMP=wasm"; fi if [ "$LTO" = "true" ]; then export CFLAGS+=" -flto"; fi if [ "$PIC" = "true" ]; then export CFLAGS+=" -fPIC"; fi -export CXXFLAGS="$CFLAGS" +export CXXFLAGS="$CFLAGS -fexceptions" export LDFLAGS="-L$TARGET/lib -O3" if [ "$WASM_BIGINT" = "true" ]; then export LDFLAGS+=" -sWASM_BIGINT"; fi if [ "$WASM_FS" = "true" ]; then export LDFLAGS+=" -sWASMFS"; fi