Skip to content
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

Scratch Link does not build for Apple Silicon / M1 #186

Open
cwillisf opened this issue Jan 23, 2021 · 3 comments
Open

Scratch Link does not build for Apple Silicon / M1 #186

cwillisf opened this issue Jan 23, 2021 · 3 comments

Comments

@cwillisf
Copy link
Contributor

Expected Behavior

Scratch Link should run natively on all current and recent macOS machines.

Actual Behavior

Scratch Link runs natively on Intel-based macOS, but only runs under Rosetta 2 on Apple M1 machines.

Discussion

Swift 5.3, which comes with Xcode 12, is required for native Apple M1 support. In theory, we should be able to add --arch x86_64 --arch arm64 to the swift build command line in order to build a "universal binary" which natively supports both architectures.

Unfortunately, the networking libraries we use, PerfectHTTPServer and PerfectWebSockets, do not build for M1 on Swift 5.3 due to some incompatibilities. It appears that PerfectlySoft, the group behind these libraries, has disbanded and the libraries are no longer maintained. This is to say: it's not just a matter of updating to the latest version of these libraries.

While we need more testing, it appears that Scratch Link runs successfully through Rosetta 2. For now, I recommend that we take advantage of this and take our time deciding how best to support M1 natively.

@cwillisf
Copy link
Contributor Author

cwillisf commented Jan 23, 2021

Investigation notes: what if we try to fix the Perfect networking libraries ourselves?

The good news is that it appears that the code changes would be relatively small. The bad news is that the necessary change is in a core library in the Perfect family of libraries. This is bad news because in order to fix the issue it appears we'd need to fork quite a few of their repositories for no other reason than to adjust their dependency tree to use our version of a "leaf" module.

Specifically, the problem centers around a call to vsyslog in PerfectLib's logging code.

Summary:

  • Fixing the "Perfect" family of libraries for M1 would probably be more work than it's worth, especially considering they're no longer maintained by their authors.

@cwillisf
Copy link
Contributor Author

cwillisf commented Jan 23, 2021

Investigation of alternative networking libraries has been moved to #187

@cikichen
Copy link

Cannot convert value of type 'CVaListPointer' to expected argument type '__darwin_va_list?' (aka 'Optional<UnsafeMutablePointer>')

Apple M1

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

No branches or pull requests

3 participants