Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sds.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ task libsdsDynamicLinux, "Generate bindings":
task libsdsDynamicMac, "Generate bindings":
let outLibNameAndExt = "libsds.dylib"
let name = "libsds"

let arch = hostCPU
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we expecting this attribute to be adapted manually?

let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\""
Copy link

@alexjba alexjba Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add the isysroot as well..No idea why it's not being picked automatically.

This made it work for me:

diff --git a/sds.nimble b/sds.nimble
index c683f4a..d1b43f4 100644
--- a/sds.nimble
+++ b/sds.nimble
@@ -1,5 +1,7 @@
 mode = ScriptMode.Verbose
 
+import strutils
+
 # Package
 version = "0.1.0"
 author = "Waku Team"
@@ -64,8 +66,9 @@ task libsdsDynamicMac, "Generate bindings":
   let name = "libsds"
 
   let arch = hostCPU
-  let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\""
-                   else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\"")
+  let sdkPath = staticExec("xcrun --show-sdk-path").strip()
+  let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
+                   else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
 
   buildLibrary outLibNameAndExt,
     name, "library/",
@@ -91,9 +94,11 @@ task libsdsStaticLinux, "Generate bindings":
 task libsdsStaticMac, "Generate bindings":
   let outLibNameAndExt = "libsds.a"
   let name = "libsds"
+  let sdkPath = staticExec("xcrun --show-sdk-path").strip()
+  let sdkFlags = "--passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
   buildLibrary outLibNameAndExt,
     name, "library/",
-    """-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
+    sdkFlags & " -d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE",
     "static"
 
 # Build Mobile iOS

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey status-im/status-app#19537 this change from Sid seems to solve the issue on macOS for me

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the tricky question is why this PR is fixing the sds build? And why isn't it working out of the box without forcing the USE_SYSTEM_NIM?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes exactly, there is an issue with this standalone library too, just building it on its own, complies it for x86_64, even on arm systems

else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\"")

buildLibrary outLibNameAndExt,
name, "library/",
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
archFlags & " -d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE",
"dynamic"

task libsdsStaticWindows, "Generate bindings":
Expand Down