【问题标题】:cgo: exec gcc: exec: "gcc": executable file not found in $PATH Error in Egress operator installationcgo: exec gcc: exec: "gcc": $PATH 中找不到可执行文件 Egress operator 安装中的错误
【发布时间】:2021-09-18 17:33:51
【问题描述】:

我正在尝试Egress Operator 来限制基于域的出口呼叫。我正在使用Ubuntu 18 Hyper-V VM,我拥有所有prerequisites

  1. 用于推送图像的 Azure 存储库
  2. Kubebuilder 用于代码生成
  3. Kustomize 用于构建 Kubernetes 清单
  4. CoreDns(默认使用 k3s)pod 正在运行
  5. Golang : go version go1.16.5 linux/amd64

但是虽然Testing locally 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

同样在 ConfigMap 中编辑 coredns 部署和 coredns Corefile 后,如coredns plugin setup 中所述,我在执行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

谁能告诉我如何解决这个问题?

【问题讨论】:

    标签: go kubernetes gcc cgo coredns


    【解决方案1】:

    您的环境似乎没有安装 gcc 编译器。请按如下方式尝试:

    sudo apt-get install build-essential
    

    sudo apt-get  build-dep  gcc
    

    然后检查是否安装成功:

    gcc --version
    

    另请参阅similar problem

    【讨论】:

      猜你喜欢
      • 2022-12-04
      • 1970-01-01
      • 2023-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多