From a63187fe1e62fc7588fe756bfc9f85812e395114 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Tue, 4 Jun 2024 10:41:48 +0800 Subject: [PATCH] fix build error for loongarch64 --- containerd.spec | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/containerd.spec b/containerd.spec index 95c152c..dedba20 100644 --- a/containerd.spec +++ b/containerd.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 # Generated by go2rpm # arm support not fully implemented: not implemented %ifnarch %{arm} @@ -40,7 +40,11 @@ export GO111MODULE=auto } %define gobuild(o:) %{expand: %global _dwz_low_mem_die_limit 0 +%ifarch loongarch64 +go build -mod=mod -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x %{?**}; +%else go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x %{?**}; +%endif } Name: %{goname} @@ -88,6 +92,14 @@ rm -rf cmd/protoc-gen-gogoctrd %gobuildroot export LDFLAGS="-X %{goipath}/version.Version=%{version}" export BUILDTAGS="no_btrfs" +go env -w GOPROXY=https://goproxy.cn,direct +%ifarch loongarch64 +go get -u golang.org/x/sys +go get -u golang.org/x/net +go get -u go.etcd.io/bbolt +go mod tidy +go mod vendor +%endif for cmd in cmd/* ; do %gobuild -o _bin/$(basename $cmd) %{goipath}/$cmd done @@ -140,6 +152,9 @@ install -D -p -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/containerd/config.toml %{_bindir}/containerd-stress %changelog +* Tue Jun 4 2024 Wenlong Zhang - 1.5.9-2 +- fix build error for loongarch64 + * Fri May 27 2022 Zhongling He - 1.5.9-1 - Update to containerd v1.5.9 -- Gitee