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

x/mobile: panic: unsupported GOARCH: arm64 #46464

Closed
yyzl0418 opened this issue May 31, 2021 · 11 comments
Closed

x/mobile: panic: unsupported GOARCH: arm64 #46464

yyzl0418 opened this issue May 31, 2021 · 11 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@yyzl0418
Copy link

goroutine 1 [running]:
main.archNDK(...)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:298
main.(*ndkToolchain).Path(0x14000197b00, 0x140000b8000, 0x29, 0x1011be402, 0x5, 0x0, 0x14000197938)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:327 +0xc0
main.envInit(0x14000016047, 0x31)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:108 +0xa0c
main.buildEnvInit(0x1014a8980, 0x1400011dc20, 0x0)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:79 +0x1a8
main.runBuildImpl(0x10149f860, 0x0, 0x0, 0x0)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/build.go:76 +0x38
main.runBuild(0x10149f860, 0x14000140020, 0x2)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/build.go:69 +0x28
main.main()
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/main.go:73 +0x2c0

device: MacBook pro m1

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label May 31, 2021
@gopherbot gopherbot added this to the Unreleased milestone May 31, 2021
@davecheney
Copy link
Contributor

please fill out the entire template.

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 31, 2021
@AlexRouSg
Copy link
Contributor

Looks like he is hitting this panic https://github.com/golang/mobile/blob/master/cmd/gomobile/env.go#L298
And looking up NDK, there is no darwin arm64 build https://developer.android.com/ndk/downloads

cc @hajimehoshi

@yyzl0418
Copy link
Author

What version of Go are you using (go version)?

$ go version
go version go1.16.3 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GO111MODULE="auto"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/xxx/Library/Caches/go-build"
GOENV="/Users/xxx/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/xxx/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xxx/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.16.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.16.3/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qh/w0rmms1543l0501ptgw_zhxh0000gn/T/go-build2439043797=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

gomobile init

What did you expect to see?

What did you see instead?

goroutine 1 [running]:
main.archNDK(...)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:298
main.(*ndkToolchain).Path(0x14000197b00, 0x140000b8000, 0x29, 0x1011be402, 0x5, 0x0, 0x14000197938)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:327 +0xc0
main.envInit(0x14000016047, 0x31)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:108 +0xa0c
main.buildEnvInit(0x1014a8980, 0x1400011dc20, 0x0)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/env.go:79 +0x1a8
main.runBuildImpl(0x10149f860, 0x0, 0x0, 0x0)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/build.go:76 +0x38
main.runBuild(0x10149f860, 0x14000140020, 0x2)
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/build.go:69 +0x28
main.main()
/Users/xxx/go/src/golang.org/x/mobile/cmd/gomobile/main.go:73 +0x2c0

@hajimehoshi
Copy link
Member

@hyangah I don't have M1 Mac then I cannot test this, but I guess gomobile should support M1 environments and this should be easy. What do you think?

@hajimehoshi
Copy link
Member

And looking up NDK, there is no darwin arm64 build https://developer.android.com/ndk/downloads

Can't the toolchains be downloaded via Android Studio?

@AlexRouSg
Copy link
Contributor

Can't the toolchains be downloaded via Android Studio?

Nope, as far as I can tell, there is no M1 build of NDK at all yet.
But M1 should be able to run x86_64 code but I'm not sure if that works with the NDK

@hajimehoshi
Copy link
Member

Ah that makes sense. Then for M1 mac, we should invoke x64 toolchains with Rosetta.

@seankhliao
Copy link
Member

seankhliao commented May 31, 2021

ndk support should be android/ndk#1299 , comments there say rosetta works

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels May 31, 2021
@yyzl0418
Copy link
Author

Can't the toolchains be downloaded via Android Studio?

Nope, as far as I can tell, there is no M1 build of NDK at all yet.
But M1 should be able to run x86_64 code but I'm not sure if that works with the NDK

” gomobile build -target=ios ” ,the same mistake

@marcofeltmann
Copy link

Ah that makes sense. Then for M1 mac, we should invoke x64 toolchains with Rosetta.

Unfortunately this may help for Android by now, but not for iOS as with Xcode 13:

❯ clang --version
Apple clang version 13.0.0 (clang-1300.0.18.6)
Target: arm64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@gopherbot
Copy link

Change https://golang.org/cl/346153 mentions this issue: cmd/gomobile: handle NDK path for darwin/arm64

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants