Skip to content

Commit 07b46ea

Browse files
committed
fix(ios): Compile nim-sds as a nim module
On IOS we're free to compile nim-sds as a nim module nim_status_client, nim-sds and status-go are all static libs. With this approach we're fixing the duplicate symbols from both nim runtimes (nim_status_client and nim-sds). We're free to re-enable `lto` without crashing the app
1 parent 926f390 commit 07b46ea

File tree

9 files changed

+19
-4
lines changed

9 files changed

+19
-4
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,9 @@
127127
[submodule "vendor/status-keycard-qt"]
128128
path = vendor/status-keycard-qt
129129
url = https://github.com/status-im/status-keycard-qt
130+
[submodule "vendor/nim-sds"]
131+
path = vendor/nim-sds
132+
url = https://github.com/logos-messaging/nim-sds.git
133+
[submodule "vendor/nim-libp2p"]
134+
path = vendor/nim-libp2p
135+
url = https://github.com/status-im/nim-libp2p.git

config.nims

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ else:
99
--define:useOpenSSL3
1010
--parallelBuild:0 # 0 == auto nr. of cores
1111

12+
when defined(ios):
13+
switch("path", "vendor/nim-sds")
14+
switch("path", "vendor/nim-libp2p")
15+
1216
if hostOS == "macosx":
1317
echo "Building for macOS"
1418
--dynlibOverrideAll # don't use dlopen()

mobile/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ else ifeq ($(OS),ios)
5353
SHELL=/bin/sh
5454
endif
5555
@echo "Copying library to mobile lib directory"
56-
@cp $(NIM_SDS_SOURCE_DIR)/build/libsds$(LIB_EXT) $(LIB_PATH)/libsds$(LIB_EXT)
5756
@cp ../vendor/status-go/build/bin/libstatus$(LIB_EXT) $(LIB_PATH)/libstatus$(LIB_EXT)
5857

5958
$(STATUS_Q_LIB): $(STATUS_Q_FILES) $(STATUS_Q_SCRIPT) $(STATUS_Q_UI_FILES)

mobile/scripts/buildNimStatusClient.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ NIM_FLAGS=(
7676
if [ "$DEBUG" -eq 1 ]; then
7777
NIM_FLAGS+=(-d:debug -d:nimTypeNames)
7878
else
79-
NIM_FLAGS+=(-d:release -d:production)
79+
NIM_FLAGS+=(-d:release -d:lto -d:production)
8080
fi
8181

8282
# build status-client with feature flags

mobile/wrapperApp/Status.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ios {
8181
-framework Foundation
8282

8383
# Base libraries (always included)
84-
LIBS += -L$$PWD/../lib/$$LIB_PREFIX -lnim_status_client -lDOtherSideStatic -lstatusq -lstatus -lsds -lssl_3 -lcrypto_3 -lqzxing -lresolv -lqrcodegen
84+
LIBS += -L$$PWD/../lib/$$LIB_PREFIX -lnim_status_client -lDOtherSideStatic -lstatusq -lstatus -lssl_3 -lcrypto_3 -lqzxing -lresolv -lqrcodegen
8585

8686
contains(DEFINES, FLAG_KEYCARD_ENABLED) {
8787
# Use entitlements with NFC support (requires paid Apple Developer account)

src/nim_status_client.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ when defined(macosx) and defined(arm64):
2626
when defined(windows):
2727
{.link: "../status.o".}
2828

29+
30+
when defined(ios):
31+
import library/libsds
32+
2933
when defined(USE_QML_SERVER):
3034
# get the host OS and localhost IP
3135
# the host OS is the OS that compiles the app, not the OS that runs the app

vendor/nim-libp2p

Submodule nim-libp2p added at 8855bce

vendor/nim-sds

Submodule nim-sds added at 5763c25

0 commit comments

Comments
 (0)