无法在win10上安装operator_sdk:“无法使用syscall.NsecToFiletime”

问题描述 投票:0回答:1

我尝试按照“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.

根据官方文档的“命令并从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\[email protected]\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\[email protected]\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\[email protected]\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\[email protected]\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\[email protected]\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

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

kubernetes makefile gnu-make operator-sdk
1个回答
0
投票

我看到 Go 有几行抱怨类型不匹配。具体来说,提到

syscall.Filetime
不能用作
"golang.org/x/sys/windows".Filetime

..\..\..\go\pkg\mod\github.com\containerd\[email protected]\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
似乎是这些错误的来源,并且它似乎与 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
    有错误

由于

go.mod
从 go 1.19 开始,请首先检查使用该版本是否有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.