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 <noreply@anthropic.com>
This commit is contained in:
Ivan FB 2026-06-09 22:48:11 +02:00
parent 5c8d0f1915
commit 08379e0c6a
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270

View File

@ -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 & "\"" &