-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
.github: cross-compile arm64 macOS asset #796
Conversation
I believe that it should be on the machine. So I guess we need to make its path known. |
In the macOS runner: $ find / -name "SecRandom.h"
[...]
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.3.1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
/System/Volumes/Data/Applications/Xcode_14.2.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/SecRandom.h
[...] |
It seems like it might be easiest to build the arm64-macos asset on macos. Prepare to do that.
It produced an error: shasum: standard input: no properly formatted SHA checksum lines found
`Security/SecRandom.h` was still not found when cross-compiling for arm64 macos, even when building on macos: /Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@ssysrand.nim.c:9:10: fatal error: 'Security/SecRandom.h' file not found ^~~~~~~~~~~~~~~~~~~~~~ nimble.nim(229) buildFromDir 1 error generated. Error: execution of an external compiler program 'zigcc -c -w -ferror-limit=3 -pthread -target aarch64-macos-none -Os -I/Users/runner/work/configlet/configlet/nimdir/lib -I/Users/runner/work/configlet/configlet/src -o /Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@ssysrand.nim.c.o /Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@ssysrand.nim.c' failed with exit code: 1 Error: Build failed for the package: configlet
e2d36cf
to
8919ed8
Compare
Some `clang --help` output: -F <value> Add directory to framework include search path -I <dir> Add directory to the end of the list of include search paths -iframeworkwithsysroot <directory> Add directory to SYSTEM framework search path, absolute paths are relative to -isysroot -iframework <value> Add directory to SYSTEM framework search path
Error is now at link time:
|
Building with the previous commit produced a link-time error: CC: configlet.nim Hint: [Link] warning(link): framework not found for '-framework Security' warning(link): Framework search paths: error(link): undefined reference to symbol '_SecRandomCopyBytes' error(link): first referenced in '/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@ssysrand.nim.c.o' error: UndefinedSymbolReference
Build workflow worked. The new executable is 1.36 MiB though. That's much bigger than the other executables - it probably shouldn't be. Possible causes:
|
The build workflow ran successfully and created this release, which has an arm64 macOS asset. Extracting the archive, we have the executable: $ file ./configlet
configlet: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE|HAS_TLV_DESCRIPTORS> @ErikSchierboom do you have access to an M1 macOS machine? If so, could you please test the configlet from the archive linked above? Please run at least The executable is now 1.09 MiB, which is still notably larger than the 655 KiB macOS x86_64 executable. But I don't know if there's anything I can do about that, apart from:
|
This reverts commit d0e67f6. It produced the error: error: LTO is not yet supported with the Mach-O object format. More details: ziglang/zig#8680
I've ran |
I wouldn't worry too much about the size, downloading 1MiB isn't that bad, especially since it doesn't happen too often. |
Thanks!
Sure. And configlet performance hardly matters, but I just meant to say that it's possible that the current arm64 macOS configlet can have worse performance on arm64 macOS than the x86_64 configlet. That is, it's possible that the lack of |
Yeah, I do expect GitHub actions to support ARM mMacOS runners soon-ish |
Continue the recent
zig cc
work, such that the next configlet release will have two new release assets:where the archive contains the executable:
configlet uuid
now usesstd/sysrand
, which on macOS uses the Security Framework. So to produce the macOS arm64 configlet, it's easiest to cross-compile from macOS x86_64, where the macOSX SDK is already available. Make the cross-compile and install-zig scripts support macOS, and add a build job for it.It looks like the macos-12 GitHub runner has SDK versions 12.3 and 13.1 installed. Use the latest one.
The new executable is about 1.09 MiB, which is notably larger than the 655 KiB macOS x86_64 executable. Possible ways to reduce the size in the future:
zig ld
supports it.Refs: #24
Refs: #122
Refs: #764