Reputation: 24508
I tried following the instructions from the official documentation page of "Operator SDK". The device I'm trying to install it on is running on Windows 10, AMD64. I installed GNU Make via Chocolatey.
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.
As per the "Command and install from master" section of the official documentation:
git clone https://github.com/operator-framework/operator-sdk
cd operator-sdk
git checkout master
make install
The last line "make install" fails:
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
What could be the reason for this error?
Upvotes: 2
Views: 145
Reputation: 161
As @vonc explained, the build errors are caused by containerd v1.4.11 module. It was intentionally set to 1.4.11 in go.mod file with the following comments:
// TODO(ryantking): investigate further, v1.5 breaks github.com/deislabs/oras, might be able to update whatever uses the old version of oras
After changing containerd version to 1.7.6 in go.mod file, operator sdk can be build successfully. All the unit tests can be passed without any issue.
github.com/containerd/containerd => github.com/containerd/containerd v1.7.6
There is another warning regarding "sqlite3-binding.c" in building which can be resolved with
go env -w CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
Note: Operator SDK on Windows is not officially supported. While it can be built and run on Windows, there are potential risks of encountering issues and limited support available
Upvotes: 1