英文:
cgo: exec gcc: exec: "gcc": executable file not found in $PATH Error in Egress operator installation
问题
我正在尝试使用Egress Operator来基于域名限制出站调用。我正在使用Ubuntu 18
的Hyper-V虚拟机,并且我已经满足了所有的先决条件:
- Azure仓库用于推送镜像
- 使用
Kubebuilder
进行代码生成 - 使用
Kustomize
构建Kubernetes清单 - 运行
CoreDns
(k3s默认)的Pod Golang
:go version go1.16.5 linux/amd64
但是在本地测试时,执行make run
命令时出现以下错误:
root@Ubuntu18-Virtual-Machine:~/egress-operator# make run
go: creating new go.mod: module tmp
go get: added sigs.k8s.io/controller-tools v0.2.4
/root/go/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths="./..."
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 2: # runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH
此外,在编辑了coredns部署和ConfigMap中的coredns Corefile后,按照coredns插件设置中的说明执行make deploy
命令时,出现以下错误:
root@Ubuntu18-Virtual-Machine:~/egress-operator# make deploy IMG=MY_REPO/egress-operator:v0.1
go: creating new go.mod: module tmp
go get: added sigs.k8s.io/controller-tools v0.2.4
/root/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 2: # runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH
有人可以告诉我如何解决这个问题吗?
英文:
I am trying Egress Operator for restricting the egress calls based on domain. I am using Ubuntu 18
Hyper-V VM and I have all prerequisites:
- Azure repository to push images
Kubebuilder
for code generationKustomize
for building the Kubernetes manifestsCoreDns
(default with k3s) pod runningGolang
:go version go1.16.5 linux/amd64
But while Testing locally make run
is giving below error:
root@Ubuntu18-Virtual-Machine:~/egress-operator# make run
go: creating new go.mod: module tmp
go get: added sigs.k8s.io/controller-tools v0.2.4
/root/go/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths="./..."
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 2: # runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH
Also after editing coredns deployment and coredns Corefile in ConfigMap, as mentioned in coredns plugin setup I am seeing blow error while executing make deploy
command:
root@Ubuntu18-Virtual-Machine:~/egress-operator# make deploy IMG=MY_REPO/egress-operator:v0.1
go: creating new go.mod: module tmp
go get: added sigs.k8s.io/controller-tools v0.2.4
/root/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 2: # runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH
Can someone let me know how to resolve this ?
答案1
得分: 3
看起来你的环境没有安装gcc编译器。请尝试以下步骤:
sudo apt-get install build-essential
或者
sudo apt-get build-dep gcc
然后检查安装是否成功:
gcc --version
还可以参考这个类似的问题。
英文:
It looks like your environment doesn't have the gcc compiler installed. Please try this as follows:
sudo apt-get install build-essential
or
sudo apt-get build-dep gcc
Then check if the installation is successful:
gcc --version
See also this similar problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论