-
Notifications
You must be signed in to change notification settings - Fork 371
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
Add support for Apple ARM64 (aka Apple Silicon) #2500
Conversation
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 this! We were actually looking at this internally, but had no code ready yet. We'll take a look at this and compare with what we had and see what fits together.
Thanks a bunch for this! We will look at it during the week and come back with a more thorough review. Do you know if this can be cross compiled from an Intel mac, or does it have to be built on an M1? Maybe the other way around works? The main question is whether or not we need two build servers or can produce all artefacts on a single machine. |
It is probably possible, but I have not looked into it unfortunately (my target was to build the app on Apple Silicon for Apple Silicon). Quick search shows that |
Building amd64 on arm64 could theoretically be possible with Rosetta 🤔 |
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, great work! The code looks nice and it seems to run pretty well. I've left a few comments that would be nice if they were fixed before merging.
This is a great step in the directions of releasing M1 native/universal builds but there are a few things that needs to be resolved before we can release it to customers. The remaining things are:
- OpenVPN and Shadowsocks x86 binaries are still bundled and those protocols can therefore not be used in the M1 build.
- We don't have a M1 build-server yet (only devices for testing). We either have to cross-compile it or set up a new build-server.
- We would probably like to produce a universal binary before releasing it to customers.
We'll continue working on those remaining issues!
@Ch00k Just to clarify the above. We don't expect you to solve OpenVPN or universal binaries etc in this PR. We can merge this after the smaller code attached comments have been fixed. Then we'll continue from there and integrate it into our real build process. |
When testing this out I found that it fails to run the |
@raksooo weird, I thought I tested the build on Linux, and it worked for me. I'll test it again. Can't test on Windows though because I don't have access to a Windows box. UPD Ack, it does fail on Linux indeed :(
UPD 2 But then how come I am able to build the proto files on Linux to use them on M1 Mac afterwards? I am running the UPD 3 Stupid me :) Of course,
As per the doc Sorry for all this written thought process. I am learning Node while working on this PR 😄 |
@Ch00k Yeah, the comment makes it sound like the use of the |
@Ch00k Done testing without |
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.
Awesome! 🎉 Thanks for fixing the comments, and thanks for the contribution! I'll merge this later today.
I just built the app end-to-end one more time, just to make sure everything still works. It does. |
👍 Thanks for rebasing. I've updated |
This adds support for building the app on Apple Silicon.
The frontend change is the most annoying part here. Due to the fact that
grpc-tools
refuses to support ARM architecture the management interface proto files need to be pre-built on a non-ARM platform. Then these proto files can be used during the main build. I added a helper scriptbuild_mi_proto.sh
to help in pre-building the proto files.On the backend only bumping of a couple of versions is needed. For
pfctl-rs
I created an issue requesting a new release. Forrust-tun
I made a PR that bumpsioctl-sys
. UPD: Both have been released on crates.ioDue to the nature of changes inCargo.toml
this PR should probably not be merged as is. Nevertheless I think it gives a good overview of the changes required to support Apple Silicon (and probably the rest of the ARM platforms, too).I tested this by building a package on with
./build.sh --dev-build
on an M1 Mac Mini.This change is