Skip to content

.github: cross-compile arm64 macOS asset#796

Merged
ee7 merged 17 commits intoexercism:mainfrom
ee7:github-cross-macos
Aug 17, 2023
Merged

.github: cross-compile arm64 macOS asset#796
ee7 merged 17 commits intoexercism:mainfrom
ee7:github-cross-macos

Conversation

@ee7
Copy link
Copy Markdown
Member

@ee7 ee7 commented Aug 16, 2023

Continue the recent zig cc work, such that the next configlet release will have two new release assets:

configlet_4.0.0-beta.14_macos_arm64.tar.gz
configlet_4.0.0-beta.14_macos_arm64.tar.gz.minisig

where the archive contains the executable:

$ file ./configlet
configlet: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE|HAS_TLV_DESCRIPTORS>

configlet uuid now uses std/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:

Refs: #24
Refs: #122
Refs: #764

@ee7
Copy link
Copy Markdown
Member Author

ee7 commented Aug 16, 2023

Security/SecRandom.h 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
#include <Security/SecRandom.h>
         ^~~~~~~~~~~~~~~~~~~~~~
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

I believe that it should be on the machine. So I guess we need to make its path known.

@ee7
Copy link
Copy Markdown
Member Author

ee7 commented Aug 16, 2023

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
[...]

ee7 added 7 commits August 16, 2023 14:15
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
@ee7 ee7 force-pushed the github-cross-macos branch from e2d36cf to 8919ed8 Compare August 16, 2023 12:15
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
@ee7
Copy link
Copy Markdown
Member Author

ee7 commented Aug 16, 2023

Error is now at link time:

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
Error: execution of an external program failed: 'zigcc   -o /Users/runner/work/configlet/configlet/configlet \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@ssystem@sexceptions.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@ssystem@sctypes.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@sdigitsutils.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sassertions.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sformatfloat.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@ssystem@sdollars.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@stypedthreads.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@scollections@ssharedlist.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@ssyncio.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@ssystem.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sposix@sposix.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sparseutils.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@smath.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@salgorithm.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sstrbasics.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sunicode.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sstrutils.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@spathnorm.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@soserrors.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@soscommon.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@sospaths2.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@sossymlinks.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@soptions.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@stimes.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@sosfiles.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@sosdirs.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@senvvars.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@sprivate@sosappdirs.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@scmdline.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sos.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sstrformat.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sterminal.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@s..@s..@s..@s.nimble@spkgs2@ssupersnappy-2.1.3-36a05ee6befe3764ed8e2a6fb5d0882c2fd090f8@ssupersnappy@sinternal.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@s..@s..@s..@s.nimble@spkgs2@ssupersnappy-2.1.3-36a05ee6befe3764ed8e2a6fb5d0882c2fd090f8@ssupersnappy.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@scollections@scritbits.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mpatched_libs@sparseopt3.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mcli.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mcompletion@scompletion.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@shashes.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@scollections@stables.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sstreams.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@slexbase.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mpatched_stdlib@sparsejson.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mpatched_stdlib@sjson.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@scollections@ssets.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@s..@s..@s..@s.nimble@spkgs2@sjsony-1.1.5-6aeb83e7481ca8686396a568096054bc668294df@sjsony.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mhelpers.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@slogging.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlogger.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mtypes_track_config.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@s..@s..@s..@s.nimble@spkgs2@sparsetoml-0.7.1-586fe63467a674008c4445ed1b8ac882177d7103@sparsetoml.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sstrtabs.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sconcurrency@scpuinfo.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@spure@sosproc.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mexec.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@sprobspecs.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@stracks.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@sexercises.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@svalidators.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mtypes_exercise_config.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mtypes_approaches_config.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mtypes_articles_config.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@ssync_common.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@ssync_docs.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@ssync_filepaths.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@ssync_metadata.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@ssync_tests.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@msync@ssync.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@m..@snimdir@slib@sstd@ssysrand.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@muuid@suuid.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mcreate@sapproaches.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mcreate@sarticles.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mcreate@screate.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mfmt@sfmt.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@minfo@sinfo.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mgenerate@sgenerate.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@sapproaches_and_articles.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@sconcept_exercises.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@sconcepts.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@sdocs.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@spractice_exercises.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@strack_config.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mlint@slint.nim.c.o \
/Users/runner/.cache/nim/configlet_r/@mconfiglet.nim.c.o \
 -lm -lm -framework Security  -target aarch64-macos-none  -ldl'
nimble.nim(229)          buildFromDir

    Error:  Build failed for the package: configlet

ee7 added 3 commits August 16, 2023 14:55
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
@ee7
Copy link
Copy Markdown
Member Author

ee7 commented Aug 16, 2023

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 lack of LTO support in zig ld
  • lack of stripping?

@ee7 ee7 marked this pull request as ready for review August 16, 2023 13:31
@ee7 ee7 requested a review from ErikSchierboom as a code owner August 16, 2023 13:31
@ee7
Copy link
Copy Markdown
Member Author

ee7 commented Aug 16, 2023

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 configlet uuid - I think that's the command that's most likely to be broken.

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:

  • Waiting till zig ld supports LTO
  • Waiting till GitHub Actions adds an arm64 macOS runner (tracked in github/roadmap#528), then compiling it natively
  • Using a non-GitHub arm64 macOS runner

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
@ee7 ee7 changed the title .github: cross-compile arm64 macos asset .github: cross-compile arm64 macOS asset Aug 16, 2023
@ErikSchierboom
Copy link
Copy Markdown
Member

@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 configlet uuid - I think that's the command that's most likely to be broken.

I've ran configlet uuid, configlet lint and configlet sync and all worked well!

@ErikSchierboom
Copy link
Copy Markdown
Member

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:

I wouldn't worry too much about the size, downloading 1MiB isn't that bad, especially since it doesn't happen too often.

@ee7 ee7 merged commit f280445 into exercism:main Aug 17, 2023
@ee7 ee7 deleted the github-cross-macos branch August 17, 2023 08:05
@ee7
Copy link
Copy Markdown
Member Author

ee7 commented Aug 17, 2023

I've ran configlet uuid, configlet lint and configlet sync and all worked well!

Thanks!

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:

I wouldn't worry too much about the size, downloading 1MiB isn't that bad, especially since it doesn't happen too often.

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 -flto costs more performance than the x86_64 emulation (of course, it'd depend on the exact command). Lacking LTO means that a function is not inlined when it is in a different module and not marked as {.inline.}.

@ErikSchierboom
Copy link
Copy Markdown
Member

Yeah, I do expect GitHub actions to support ARM mMacOS runners soon-ish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants