英文:
VSCode Debugger not working under Rosetta
问题
尝试使用VSCode调试器时,我收到了以下错误信息:
“无法启动:无法启动进程:无法在Rosetta下运行,请检查安装的Go版本是否适用于您的CPU架构。”
一些背景信息,我阅读了类似问题的解决方案:
- 我使用的是不支持GO arm64的foundationDB。
- 因此,我正在使用GO amd64。
- 切换到arm64将意味着foundationDB将无法工作,这是不可行的选择。
我尝试下载dlv,但它不起作用。我还尝试了这里提出的解决方案,在x86-64上运行VSCode集成终端。
是否有一种方法可以让调试器在使用go1.18 darwin/amd64的Apple M1上工作?
英文:
when trying to use the VSCode Debugger, I get an error message:
"Failed to launch: could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture"
some background context as I read solutions for similar questions:
- I use foundationDB which does not work with GO arm64
- For this reason, I am using GO amd64
- Switching to arm64 would mean that foundationDB will not work, which is not an option
I tried downloading dlv, but it doesn't work. Also tried the solution proposed here to run VSCode integrated terminal in x86-64.
Is there a way for the debugger to work with Apple M1 using go1.18 darwin/amd64?
答案1
得分: 6
我刚刚在我的 M1 上遇到了这个问题,并成功解决了。以下是我的步骤:
-
前往 go 下载页面,https://go.dev/dl/,下载适用于 arm 架构的 go 安装程序。具体来说,下载 go<版本>.darwin-arm64.pkg。
-
安装 go,如果检测到之前的版本,同意替换。
-
打开终端,验证 go 版本,应该显示为 "go version go<版本> darwin/arm64"。
-
在 VSCode 中,点击插件,找到已安装的 Go 插件,卸载并重新加载 VSCode。
-
安装插件完成后,在 VSCode 中按下 Ctrl + Shift + P,打开命令面板,然后输入 go: Install,选择 go: Install/Update Tools,然后勾选第一个复选框以安装所有工具。
-
安装 Go 工具完成后,重新加载 VSCode,然后尝试设置断点。
英文:
I just got this issue on my M1 and was able to resolve. Here are my steps:
-
go to the go download page, https://go.dev/dl/ and download the arm version of go installer. Specifically, go<version>.darwin-arm64.pkg
-
install go, if it detects a previous version, agree to replace
-
open terminal and verify go version and it should say "go version go<version> darwin/arm64"
-
On VSCode, click on plugins, find the installed Go plugin, and uninstall then reload VSCode.
-
When the plugin installation is complete, press Ctrl + Shift + P in VSCode to bring up the Command Palette, then type go: Install and select go: Install/Update Tools, then click the first checkbox to install all Tools.
-
When Go Tools install is complete, reload VSCode and retry breakpoint.
答案2
得分: 0
这是Mac上一个常见的问题。解决方法是在ARM-64架构下安装Golang和VSCODE。
以下是一些参考链接:
https://github.com/go-delve/delve/issues/2604
https://stackoverflow.com/questions/69343900/cannot-run-debug-go-using-vscode-on-mac-m1
英文:
This is a popular issue on Mac. The solution is to install Golang and VSCODE in ARM-64 (not AMD64).
Here are some links for reference
https://github.com/go-delve/delve/issues/2604
https://stackoverflow.com/questions/69343900/cannot-run-debug-go-using-vscode-on-mac-m1
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论