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

Fix Android builds for darwin/arm64 #2440

Merged
merged 1 commit into from Sep 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/fyne/internal/mobile/env.go
Expand Up @@ -326,6 +326,13 @@ func archNDK() string {
arch = "x86"
case "amd64":
arch = "x86_64"
case "arm64":
// For darwin/arm64, see https://golang.org/cl/346153.
if runtime.GOOS == "darwin" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why if darwin? I thought this was a fix for Android NDK not supporting arm64?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for building android on a darwin/arm64 machine. Hence, GOOS == darwin, and the GOARCH is arm64.

I personally don't want to write the darwin check, but in the Go's CL review process, the Go team suggests to better just check for darwin, because on arm64 platforms, only darwin is (partially )supported in NDK. They don't want to risk an undefined behavior such as someone using linux/arm64 or windows/arm64 where NDK does not yet fully supported.

Besides, on a darwin/arm64 machine, using x86_64 is a temporary solution (yet) because NDK does not have any arm64 distribution at the moment.

arch = "x86_64"
break
}
fallthrough
default:
panic("unsupported GOARCH: " + runtime.GOARCH)
}
Expand Down