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

internal/cpu: cpu feature detect failed on darwin/arm64 #24753

Closed
mengzhuo opened this issue Apr 7, 2018 · 5 comments
Closed

internal/cpu: cpu feature detect failed on darwin/arm64 #24753

mengzhuo opened this issue Apr 7, 2018 · 5 comments

Comments

@mengzhuo
Copy link
Contributor

mengzhuo commented Apr 7, 2018

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

go 1.10 and tip

What did you do?

run ./all.bash

--- FAIL: TestARM64minimalFeatures (0.00s)

	cpu_test.go:55: HasASIMD expected true, got false
FAIL

What did you expect to see?

all test pass

@mengzhuo
Copy link
Contributor Author

mengzhuo commented Apr 7, 2018

@eliasnaur I've open an issue here. Since I don't know how to build up a darwin/arm64 platform on my Mac maybe you can give me some page/ tutorial about it.

@cherrymui
Copy link
Member

Apparently the implementation in internal/cpu/cpu_arm64.go is Linux only. On darwin, arm64_hwcap is not linknamed from runtime/os_darwin_arm64.go, and it doesn't have the same hwcap anyway. So internal/cpu doesn't work on darwin/arm64.

@eliasnaur
Copy link
Contributor

It's some work to set up, so if you like, I can test any CL that you come up with.

If you like to attempt a darwin/arm64 setup, the steps are roughly:

  • Install Xcode and make sure you can run a blank project on an iPhone attached to your Mac. Xcode will step you through the Apple Developer account setup if you don't already have one.
  • Install Homebrew, libimobiledevice and ios-deploy:
# Only HEAD version of libimobiledevie
$ brew install -HEAD libimobiledevice
# Node is for npm
$ brew install node
$ npm install --unsafe-perm=true ios-deploy
  • run go run $GOROOT/misc/ios/detect.go. It should output a suggestion(s) for the environment variables needed to codesign tests:
$ go run misc/ios/detect.go
Available provisioning profiles below.
NOTE: Any existing app on the device with the app id specified by GOIOS_APP_ID
will be overwritten when running Go programs.

export GOIOS_DEV_ID=...
export GOIOS_APP_ID=...
export GOIOS_TEAM_ID=...
  • export the variables in your current shell and run tests. $GOROOT/bin has to be in your path for go to access the go_darwin_arm*_exec wrappers:
$ export $PATH=$GOROOT/bin:$PATH
$ cd $GOROOT/src
$ GOARCH=arm64 ./iostest.bash

Because of the way they're harnessed, running tests are quite slow on iOS. You may want to run only your test with GOARCH=arm64 go tool dist test go_test:internal/cpu

@mengzhuo
Copy link
Contributor Author

mengzhuo commented Apr 7, 2018

@eliasnaur I think I will add a CL that remove darwin/openbsd support right now to let them pass the test.

And add another CL to support darwin/netbsd etc.

@gopherbot
Copy link

Change https://golang.org/cl/105455 mentions this issue: internal/cpu: skip arm64 feature test for none linux

@golang golang locked and limited conversation to collaborators Apr 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants