linux_amd64/link: running gcc failed: exec: “gcc“ 错误解决

building the target: tool_ctl... 

go build -ldflags "-X configcenter/src/common/version.CCVersion=my-branch -X configcenter/src/common/version.CCBuildTime=2023-07-19T19:11:04+0800 -X configcenter/src/common/version.CCGitHash=0f24e8844f7406effbfe0654cd31152fca0d80b9 -X configcenter/src/common/version.CCTag=release-v3.10.29 -X configcenter/src/common/version.CCDistro=community -X configcenter/src/common/version.GoVersion=go1.20.6" -o /usr/local/cmdbSource/configcenter/src/bin/build/my-branch/tool_ctl/tool_ctl
make[1]: 离开目录“/usr/local/cmdbSource/configcenter/src/tools/cmdb_ctl”
enter directory:  /usr/local/cmdbSource/configcenter/src/tools/monstache
make[1]: 进入目录“/usr/local/cmdbSource/configcenter/src/tools/monstache”
go build -buildmode=plugin -o /usr/local/cmdbSource/configcenter/src/bin/build/my-branch/monstache/etc/monstache-plugin.so *.go
# command-line-arguments
loadinternal: cannot find runtime/cgo
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exec: "gcc": executable file not found in $PATH

make[1]: *** [default] 错误 1
make[1]: 离开目录“/usr/local/cmdbSource/configcenter/src/tools/monstache”
make: *** [server] 错误 2
[root@localhost src]# 

错误内容是,没有安装gcc ,
执行下面的命令,来验证gcc有没有安装

gcc -v 

看看是否安装成功,如果成功重启你的编辑器重新运行就不报错了

执行下面的命令,来安装gcc

sudo yum install gcc

你可能感兴趣的:(linux,服务器,centos)