-
Notifications
You must be signed in to change notification settings - Fork 763
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
Build/test fails with "Undefined symbols for architecture x86_64" error on Apple M1 & go1.16beta1 #1087
Comments
@PieterVoorwinden It looks like, VSCode is using Either open the code in the right |
@hyangah I've got this MacBook since 2 days and I'm sure I only installed Go 1.16beta1. See this screenshot. It says 1.16beta1 in the corner left below and to use Go 1.15 I've to |
@PieterVoorwinden Thanks for the screenshot. Looks like the go extension was confused and lying.
|
@hyangah I installed go with Output from Iterm:
Output of
The go envs printed in |
@PieterVoorwinden Thanks. That's so strange. Can you whare with me how to install go1.16beta1 using homebrew? And, can you run the go build command Edit: Looks like homebrew is doing something funny for arm CPU - so, the version mismatch is a redherring. https://github.com/Homebrew/homebrew-core/blob/736c68b16a9df5c45ac6cd043fe30aaa9847cb80/Formula/go.rb#L7-L10 |
@hyangah here is the output for It indeed looks like the 1.15.6 version is coming from the Homebrew repository. I literally ran
It's indeed the 1.16 beta installed at the go 1.15.6 location. |
@hyangah It somehow doesn't fail in every project: |
@PieterVoorwinden Thanks for providing the info. We think this is because VSCode is an x86 binary - if the ancestor process is for x86, child processes default to x86 which confuses the C compiler later. A workaround suggested is to explicitly specify the arch. Can you try The other project succeeds probably because that doesn't involve cgo. |
Here is the |
@bcmills @cherrymui From the log @PieterVoorwinden provided, I still see
|
I'd still like to see "go1.15.6" not appear in the failure output before filing this as a Go 1.16 bug. |
Re: 'go1.15.6' string in the trace: Homebrew/homebrew-core#69000 will not be fixed - it requires a bigger change in their CI, and go 1.16 release is not too far away I hope. It looks like vscode M1 support will be included in the next release (microsoft/vscode#106770) and the insider version is available for download (https://code.visualstudio.com/insiders/). |
Change https://golang.org/cl/283812 mentions this issue: |
On Apple Silicon Mac, the C compiler has an annoying default target selection, depending on the ancestor processes' architecture. In particular, if the shell or IDE is x86, when running "go build" even with a native ARM64 Go toolchain, the C compiler defaults to x86, causing build failures. We pass "-arch" flag explicitly to avoid this situation. Fixes #43692. Fixes #43476. Updates golang/vscode-go#1087. Change-Id: I80b6a116a114e11e273c6886e377a1cc969fa3f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/283812 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
@hyangah Thanks for the help, much appreciated! Not sure when/if this issue can be closed, leaving it up to you. |
@PieterVoorwinden Thank you for reporting the issue and providing sufficient info necessary for investigation. |
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gogopls -v version
to get version of Gopls if you are using the language server.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env
to get the go development environment detailsShare the Go related settings you have added/edited
Describe the bug
Testing in VScode isn't working for me. Running
go test -timeout 45s -run ^TestComparison$ git.profects.com/agro4all/comparison-api/handler
in my terminal works without any issue:ok git.profects.com/agro4all/comparison-api/handler 0.425s
But when I press
Run test
inside VSCode it fails with an error.The same error occurs when testing via the integrated terminal.
I am not sure whether this is a problem on my side but the test succeeds when running in my terminal, which is weird. Thanks for the help in advance.
The text was updated successfully, but these errors were encountered: