MacOS 12中VSCode安装Go开发扩展报错:setresgid/setresuid隐式声明
MacOS 12下安装VSCode Go扩展编译错误解决
错误信息
linux_syscall.c:67:13: note: did you mean 'setregid'?
runtime/cgo
linux_syscall.c:67:13: 错误:函数'setresgid'的隐式声明在C99中无效 [-Werror,-Wimplicit-function-declaration]
linux_syscall.c:67:13: 提示:你是不是想使用'setregid'?
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/unistd.h:593:6: 提示:'setregid'在此处声明
linux_syscall.c:73:13: 错误:函数'setresuid'的隐式声明在C99中无效 [-Werror,-Wimplicit-function-declaration]
linux_syscall.c:73:13: 提示:你是不是想使用'setreuid'?
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/unistd.h:595:6: 提示:'setreuid'在此处声明
解决步骤
- 检查并重置Go环境变量:
打开终端执行go env,确认GOOS为darwin,GOARCH根据芯片类型为amd64(Intel芯片)或arm64(M系列芯片)。若不符,执行以下命令修正:go env -w GOOS=darwin go env -w GOARCH=amd64 # M系列芯片替换为 arm64 - 重新安装Go扩展依赖工具:
在VSCode中按下Cmd+Shift+P,输入Go: Install/Update Tools,选择全部工具完成安装。 - 重置Command Line Tools(若上述步骤无效):
终端执行xcode-select --install,完成安装后重启VSCode重试。
内容的提问来源于stack exchange,提问作者Bruce Dong
相关产品推荐
相关产品推荐

