-
Notifications
You must be signed in to change notification settings - Fork 2
fix: Add condition to check hostCpu and then build based on that #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Ivansete-status
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for it! 🙌
I just added a tiny question so far
| let outLibNameAndExt = "libsds.dylib" | ||
| let name = "libsds" | ||
|
|
||
| let arch = hostCPU |
There was a problem hiding this comment.
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 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.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
No description provided.