fix: Add condition to check hostCpu and then build based on that#37
fix: Add condition to check hostCpu and then build based on that#37Ivansete-status merged 1 commit intomasterfrom
Conversation
Ivansete-status
left a comment
There was a problem hiding this comment.
Thanks for it! 🙌
I just added a tiny question so far
sds.nimble
Outdated
| let outLibNameAndExt = "libsds.dylib" | ||
| let name = "libsds" | ||
|
|
||
| let arch = hostCPU |
There was a problem hiding this comment.
Are we expecting this attribute to be adapted manually?
There was a problem hiding this comment.
its a constant coming from nim
There was a problem hiding this comment.
Interesting! I wasn't aware of that :D
sds.nimble
Outdated
| let name = "libsds" | ||
|
|
||
| let arch = hostCPU | ||
| let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\"" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Hey status-im/status-app#19537 this change from Sid seems to solve the issue on macOS for me
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Hi @alexjba , that's interesting
Thanks for the comments!
Kindly submit a separate PR with the fixes for .a
Cheers
7caa0e7 to
13c3c34
Compare
Ivansete-status
left a comment
There was a problem hiding this comment.
LGTM! Thanks so much indeed for it and the patience! 🥳
This PR is needed to make sure
libsds.dylibis built with the proper architecture on any macos machine