Golang无法启动调试,显示找不到框架CoreFoundation。

huangapple go评论76阅读模式
英文:

golang can't start debug, shows framework not found CoreFoundation

问题

我正在使用Macbook Pro M1,在数据迁移或升级到Monterey后(不确定是哪个原因),Golang似乎无法进行调试或执行"go list -compiled"命令。我尝试重新安装/更新Golang,但结果仍然相同。

Golang版本:1.17.3 darwin/arm64

当我开始调试时出现以下错误消息:

构建错误:go build -o /var/folders/x8/s3w_s9rj0qj74hs68wvqs1740000gp/T/__debug_bin4251008076 -gcflags all=-N -l .
# runtime/cgo
ld: 找不到框架CoreFoundation
clang: 错误:链接器命令失败,退出代码为1(使用-v查看调用)(退出状态2)

当执行"go list -compiled"命令时出现以下错误消息:

# runtime/cgo
ld: 找不到框架CoreFoundation
clang: 错误:链接器命令失败,退出代码为1(使用-v查看调用)
confcenter

你可以尝试以下方法:

  1. 确保你的系统已经安装了Monterey的所有更新补丁,并且已经重新启动了电脑。
  2. 尝试使用Homebrew重新安装Golang,确保使用的是M1芯片的版本。
  3. 检查你的环境变量设置,确保Golang的路径正确配置。
  4. 如果你使用了任何第三方库或框架,确保它们也已经更新到与Monterey兼容的版本。
  5. 在Golang的官方论坛或社区中搜索类似的问题,看看其他人是否遇到了相同的问题并找到了解决方法。

希望这些方法能帮到你!

英文:

I'm using Macbook pro m1, after data migration or update to monterey(not sure which cause this), golang seems can't debug or go list -compiled. I tried to reinstall/update golang and the result is same

go version: 1.17.3 darwin/arm64

Error msg when I start debug

Build Error: go build -o /var/folders/x8/s3w_s9rj0qj74hs68wvqs1740000gp/T/__debug_bin4251008076 -gcflags all=-N -l .
# runtime/cgo
ld: framework not found CoreFoundation
clang: error: linker command failed with exit code 1 (use -v to see invocation) (exit status 2)

Error msg when go list -compiled

# runtime/cgo
ld: framework not found CoreFoundation
clang: error: linker command failed with exit code 1 (use -v to see invocation)
confcenter

what can i do, any idea?

答案1

得分: 4

你需要重新安装CommandLineTools。xcode-select显示一切都是最新的,但这个信息似乎是错误的。

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
英文:

You need to reinstall the CommandLineTools. xcode-select says everything is up to date, but this information seems to be false.

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

huangapple
  • 本文由 发表于 2021年11月19日 15:09:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/70031053.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定