From 08379e0c6aa7425ed758c11ec0ffefe3346eb2b7 Mon Sep 17 00:00:00 2001 From: Ivan FB Date: Tue, 9 Jun 2026 22:48:11 +0200 Subject: [PATCH] fix(build): restore -d:noSignalHandler for libsds libsds is loaded into the Go-based status-go process, where the Go runtime must own SIGSEGV (it relies on it for nil-deref -> sigpanic recovery, stack growth and goroutine preemption). The Makefile->nimble build refactor dropped the -d:noSignalHandler flag that the previous `make ... NIMFLAGS=-d:noSignalHandler` build passed, so the embedded Nim runtime began installing its own signal handlers and hijacking the signals Go needs. This crashed status-go functional tests (e.g. test_offline_node_backfills_history_on_login) on login. Add the flag to buildLibrary (covers all desktop dynamic/static tasks) and to the iOS and Android builds so every Go-linked libsds keeps Go's signal handling intact. Co-Authored-By: Claude Opus 4.8 --- sds.nimble | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sds.nimble b/sds.nimble index 5d29eea..11ae9c3 100644 --- a/sds.nimble +++ b/sds.nimble @@ -30,16 +30,16 @@ proc buildLibrary( if `type` == "static": exec "nim c" & " --out:build/" & outLibNameAndExt & - " --threads:on --app:staticlib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds " & + " --threads:on --app:staticlib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds -d:noSignalHandler " & extra_params & " " & srcDir & name & ".nim" else: when defined(windows): exec "nim c" & " --out:build/" & outLibNameAndExt & - " --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds " & + " --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds -d:noSignalHandler " & extra_params & " " & srcDir & name & ".nim" else: exec "nim c" & " --out:build/" & outLibNameAndExt & - " --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds " & + " --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds -d:noSignalHandler " & extra_params & " " & srcDir & name & ".nim" proc getMyCpu(): string = @@ -159,8 +159,8 @@ proc buildMobileIOS(srcDir = ".", sdkPath = "") = # Use unique symbol prefix to avoid conflicts with other Nim libraries exec "nim c" & " --nimcache:" & nimcacheDir & " --os:ios --cpu:" & cpu & " --compileOnly:on" & " --noMain --mm:refc" & " --threads:on --opt:size --header" & - " --nimMainPrefix:libsds" & " --cc:clang" & " -d:useMalloc" & " " & srcDir & - "/libsds.nim" + " --nimMainPrefix:libsds" & " --cc:clang" & " -d:useMalloc" & " -d:noSignalHandler" & + " " & srcDir & "/libsds.nim" # 2) Compile all generated C files to object files with hidden visibility # This prevents symbol conflicts with other Nim libraries (e.g., libnim_status_client) @@ -257,6 +257,7 @@ proc buildMobileAndroid(srcDir = ".", extra_params = "") = exec "nim c" & " --out:" & outDir & "/libsds.so" & " --threads:on --app:lib --opt:size --noMain --mm:refc --nimMainPrefix:libsds" & + " -d:noSignalHandler" & " --cc:clang" & " --clang.exe:\"" & ndkClang & "\"" & " --clang.linkerexe:\"" & ndkClang & "\"" &