kubernetes - win10上无法安装operator_sdk : "cannot use syscall.NsecToFiletime"

标签 kubernetes makefile gnu-make operator-sdk

我尝试按照“Operator SDK”官方文档页面的说明进行操作。我尝试安装它的设备运行的是 Windows 10、AMD64。我通过 Chocolatey 安装了 GNU Make。

 make --version
GNU Make 4.4.1
Built for Windows32
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

根据官方文档的“Command and install from master ”部分:

git clone https://github.com/operator-framework/operator-sdk
cd operator-sdk
git checkout master
make install

最后一行“make install”失败:

make install
go install -gcflags "all=-trimpath=C:/Users/erjan/Downloads/operator_k8s_sdk" -asmflags "all=-trimpath=C:/Users/erjan/Downloads/operator_k8s_sdk" -ldflags " -X 'github.com/operator-framework/operator-sdk/internal/version.Version=v1.31.0+git' -X 'github.com/operator-framework/operator-sdk/internal/version.GitVersion=v1.31.0-3-gd21ed649' -X 'github.com/operator-framework/operator-sdk/internal/version.GitCommit=d21ed6499ebfc8ecdb4508e1c2a2a0cfd2a151f3' -X 'github.com/operator-framework/operator-sdk/internal/version.KubernetesVersion=v1.26.0' -X 'github.com/operator-framework/operator-sdk/internal/version.ImageVersion=v1.31.0' "  ./cmd/# github.com/containerd/containerd/archive
..\..\..\go\pkg\mod\github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9dfef2f3e9fcf4f3f8eff9ddebacb3a9b3acac" rel="noreferrer noopener nofollow">[email protected]</a>\archive\tar_windows.go:234:19: cannot use syscall.NsecToFiletime(hdr.AccessTime.UnixNano()) (value of type syscall.Filetime) as "golang.org/x/sys/windows".Filetime value in struct literal
..\..\..\go\pkg\mod\github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c0f0302180d0502091e082c1a5d4258425d5d" rel="noreferrer noopener nofollow">[email protected]</a>\archive\tar_windows.go:235:19: cannot use syscall.NsecToFiletime(hdr.ModTime.UnixNano()) (value of type syscall.Filetime) as "golang.org/x/sys/windows".Filetime value in struct literal
..\..\..\go\pkg\mod\github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8dbd7d6ccd9d1d6ddcadcf8ce89968c968989" rel="noreferrer noopener nofollow">[email protected]</a>\archive\tar_windows.go:236:19: cannot use syscall.NsecToFiletime(hdr.ChangeTime.UnixNano()) (value of type syscall.Filetime) as "golang.org/x/sys/windows".Filetime value in struct literal
..\..\..\go\pkg\mod\github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9efdf1f0eafff7f0fbecfadee8afb0aab0afaf" rel="noreferrer noopener nofollow">[email protected]</a>\archive\tar_windows.go:239:17: cannot use syscall.NsecToFiletime(hdr.ModTime.UnixNano()) (value of type syscall.Filetime) as "golang.org/x/sys/windows".Filetime value in struct literal
..\..\..\go\pkg\mod\github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8cefe3e2f8ede5e2e9fee8ccfabda2b8a2bdbd" rel="noreferrer noopener nofollow">[email protected]</a>\archive\tar_windows.go:257:27: cannot use syscall.NsecToFiletime(createTime.UnixNano()) (value of type syscall.Filetime) as "golang.org/x/sys/windows".Filetime value in assignment
make: *** [Makefile:75: install] Error 1

此错误的原因可能是什么?

最佳答案

我看到 Go 有几行提示类型不匹配。具体来说,提到syscall.Filetime不能用作 "golang.org/x/sys/windows".Filetime .

..\..\..\go\pkg\mod\github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d9bab6b7adb8b0b7bcabbd99afe8f7edf7e8e8" rel="noreferrer noopener nofollow">[email protected]</a>\archive\tar_windows.go:234:19: cannot use syscall.NsecToFiletime(hdr.AccessTime.UnixNano()) (value of type syscall.Filetime) as "golang.org/x/sys/windows".Filetime value in struct literal

syscall.Filetime 类型的值正在使用 "golang.org/x/sys/windows".Filetime 类型的值是期待。这是一个类型不匹配的问题。文件tar_windows.go github.com/containerd/containerd内package 似乎是这些错误的根源,并且它似乎与 Windows 上处理文件时间戳的方式有关。

containerd/containerd v1.4.11考虑到 operator-framework/operator-sdk 似乎很旧项目本身需求 containerd v1.7.0

因为我通过 make install 得到了同样的错误,我先尝试了go build -a -v ... ,这不会触发错误。 Makefile 在 go install ./cmd/{operator-sdk,helm-operator} 上失败

  • go install ./cmd/helm-operator有效。
  • go install ./cmd/operator-sdk有错误

您的问题已确认该错误 operator-framework/operator-sdk issue 6585

We do not officially support or build binaries for windows. But we are open to receiving any help with contributions.
Duplicate of #6586

Operator SDK doesn't officially support or build binaries for Windows.

However, there have been instances where users could still build SDK binary from master on their windows machines. This error seems to be coming from github.com\containerd\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c7f7372687d7572796e785c6a2d3228322d2d" rel="noreferrer noopener nofollow">[email protected]</a>.
Looks like it may have an issue. Also, we have explicitly pinned containerd to 1.4.11:

operator-sdk/go.mod:

github.com/containerd/containerd => github.com/containerd/containerd v1.4.11 

because a bump in it breaks github.com/deislabs/oras.

I would suggest to start by checking if a bump in dependencies fixes these issues without breaking anything else in SDK. If so, we can merge that in master to fix it. Unfortunately, supporting windows builds has not been in our roadmap, but if you would like to try it out, we would appreciate any contributions.

关于kubernetes - win10上无法安装operator_sdk : "cannot use syscall.NsecToFiletime",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77196047/

相关文章:

ssl - Hashicorp Consul - 如何从 Kubernetes 集群中的 Pod 中执行经过验证的 TLS

makefile - 在包含组件 Makefile 之前如何运行命令?

c++ - 为具有不同标志的目标文件重构 Makefile

makefile - 条件生成文件中的变量?

kubernetes - 启用 ExpandPersistentVolumes

kubernetes - 通过 daemonset 运行的 Fluentd pod 因谷歌容器引擎上的警告而终止

kubernetes - Kubernetes 中单个 Pod 中容器终止的控制顺序

c++ - 我需要帮助将 vcxproj 转换为 cmake

macos - 在 OSX 10.10.5 上安装 OMake 时出错

build - gnu Make,如何强制假目标运行多次?