-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
go: bootstrap via Rosetta 2 on Apple Silicon #66166
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
Conversation
Please see #65696 (comment) |
Hmm, I understand not wanting to carry Rosetta 2 builds, but this would enable testing all Go Formulae on Apple Silicon before February, which seems worthwhile. Otherwise, once Go 1.16 comes out there's going to be still a lot of work left to do to support the entire tree that depends on Note that unlike #65696, this PR builds a native toolchain. |
Go can easily cross-compile an arm64 toolchain running on Rosetta 2, which lets us build HEAD without starting from arm64 binaries. Had to update the bootstrap compiler to Go 1.15 since Go 1.7 segfaults on Rosetta 2 (or maybe on Big Sur, haven't checked). This enables building --HEAD and then Formulae that depend on go.
The |
Receiving an error when trying to install this modified formula
|
Fixed by install with |
Not an open-source newbie, but totally new to Go. Would like to install it for some other brews that require it, but I'm on Apple Silicon. Is there a way to install Go with ONLY having an ARM-based homebrew installation? I really don't want to pollute this new Mac with x86 homebrew/builds. |
No, not until there is a Go version that supports it probably |
Follow golang/go#42684 (comment) |
That's what this PR does. You can cherry-pick it and then |
How do I do that? Regular |
The first beta release of Go 1.16 is now out, and it adds support for macOS ARM64: https://tip.golang.org/doc/go1.16. I managed to get it installed natively:
These were the changes I made to diff --git a/Formula/go.rb b/Formula/go.rb
index 7e7beada8d..25f0e97588 100644
--- a/Formula/go.rb
+++ b/Formula/go.rb
@@ -4,14 +4,13 @@ class Go < Formula
license "BSD-3-Clause"
stable do
- url "https://golang.org/dl/go1.15.5.src.tar.gz"
- mirror "https://fossies.org/linux/misc/go1.15.5.src.tar.gz"
- sha256 "c1076b90cf94b73ebed62a81d802cd84d43d02dea8c07abdc922c57a071c84f1"
+ url "https://golang.org/dl/go1.16beta1.src.tar.gz"
+ sha256 "48e032c8cf71af4dc8119a29ee829c4fbd5265e32fd012564d4a70bb207695c1"
go_version = version.major_minor
resource "gotools" do
url "https://go.googlesource.com/tools.git",
- branch: "release-branch.go#{go_version}"
+ branch: "release-branch.go1.15"
end
end
@@ -38,8 +37,8 @@ class Go < Formula
# Don't update this unless this version cannot bootstrap the new version.
resource "gobootstrap" do
on_macos do
- url "https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz"
- sha256 "51d905e0b43b3d0ed41aaf23e19001ab4bc3f96c3ca134b48f7892485fc52961"
+ url "https://storage.googleapis.com/golang/go1.16beta1.darwin-arm64.tar.gz"
+ sha256 "fd57f47987bb330fd9b438e7b4c8941b63c3807366602d99c1d99e0122ec62f1"
end
on_linux do and then I installed it with Note: There was no 1.16 branch on the gotools repository so I pointed it at the 1.15 branch instead. |
Let's move to the beta version instead, indeed of using Rosetta 2. |
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?Go can easily cross-compile an arm64 toolchain running on Rosetta 2,
which lets us build HEAD without starting from arm64 binaries.
Had to update the bootstrap compiler to Go 1.15 since Go 1.7 segfaults
on Rosetta 2 (or maybe on Big Sur, haven't checked).
This enables building --HEAD and then Formulae that depend on go.