use*_*075 16 debugging go goland apple-m1
编辑 2021-01-28:这整个问题现在已经过时了,因为 GoLand 2020.3.2今天发布了,并且它包含了一个工作探索。正如发行说明所指出的,不要忘记删除您可能所做的更改。
我正在尝试在 Apple Silicon 上使用 GoLand 调试 golang 项目,但它不起作用;错误如下:
API server listening at: [::]:62619
debugserver-@(#)PROGRAM:LLDB PROJECT:lldb-1200.0.44 for x86_64.
error: failed to launch process /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver: (os/kern) invalid argument
Exiting.
could not launch process: stub exited while waiting for connection: exit status 0
Run Code Online (Sandbox Code Playgroud)
Mr.*_*ley 46
我golang 1.16.6
仍然面临与此错误消息相同的问题:
Use go sdk for darwin/arm64
我的解决方案是添加以下 ENV
GOOS=darwin, GOARCH=arm64
编辑 2021-01-28:整个问题(以及这个答案)现在已经过时了,因为 GoLand 2020.3.2 已于今天发布,并且它包含一个工作钻研。正如发行说明所指出的,不要忘记删除您可能所做的更改。
受到user14892075 的回答的刺激,主要是https://www.reddit.com/r/golang/comments/kqgxel/debugging_wcli_and_goland_works_on_apple_m1/这里是技术,直到 Goland 和 dlv 正式发布
brew install golang
如果您有arm64版本的brew,它现在运行得很好。此时您将获得 golang v1.16-beta1。git clone https://github.com/go-delve/delve
然后用 构建它cd delve && make install
,这会将 delve 放入 ~/go/bin/dlv-Ddlv.path=/Users/rfay/go/bin/dlv
(将用户名从 rfay 更改为您的用户名,或将路径编辑为您构建的 dlv 的完整路径)。GoLand使用Delve作为调试器。Delve 尚不支持 Apple Silicon。
Jetbrains 和 Delve 上有错误单来跟踪这一点。我建议您查看这些票证以获取更新:
但是,在 Go 版本 1.16 之前,不要指望会出现“稳定”和官方的东西,该版本拥有官方 Apple Silicon 支持。目前,计划于二月发布。
Go 支持 Apple Silicon 可能是 Delve 在 Apple Silicon 上工作的先决条件,因为通过 Rosetta 进行调试似乎不可行。因此,Delve 需要使用 Go 1.16 进行编译,才能在 Apple Silicon 上本地运行。
因此,Apple Silicon 对 Delve 的官方支持可能不会在 2021 年 2 月之前发生。