aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-containers/cri-tools/cri-tools/0001-build-allow-environmental-CGO-settings-and-pass-dont.patch
blob: 29e0367b5b1a9a79ffd48813f2b418b07ed81158 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 567b618f2ab9bb722826688d84f328773e4f37ce Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
Date: Wed, 17 Aug 2022 11:03:09 -0400
Subject: [PATCH] build: allow environmental CGO settings and pass
 dontusecurrentpkgs

The build system already knows whether or not we want to use CGO,
so we remove the hardcoded variant so our exported environment
variable will control the enablement.

Since our oe-core go infrastructure insists on both -pie and static
builds (for the most part), and that is not recommended by many
packages, we end up with errors like:

   1.20.0+gitec9e336fd8c21c4bab89a6aed2c4a138c8cfae75/src/import/_output/crictl \
        -ldflags '-X github.com/kubernetes-sigs/cri-tools/pkg/version.Version=1.20.0' \
        -tags '' \
        github.com/kubernetes-sigs/cri-tools/cmd/crictl
    # github.com/kubernetes-sigs/cri-tools/cmd/crictl
    cannot find package runtime/cgo (using -importcfg)
    /work/cortexa72-poky-linux/cri-tools/1.20.0+gitec9e336fd8c21c4bab89a6aed2c4a138c8cfae75-r0/recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link:
    cannot open file : open : no such file or directory

In a similar manner to:

https://www.yoctoproject.org/pipermail/meta-virtualization/2019-March/004084.html

We introduce '-a -pkgdir dontusecurrentpkgs' to mask/fix the problem,
and continue to work towards non-static builds.

Upstream-Status: Inappropriate [embedded specific]

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 src/import/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: cri-tools-1.27.0+gite73a7139ed4986d6a0db784ae7a036841a02b351/src/import/Makefile
===================================================================
--- cri-tools-1.27.0+gite73a7139ed4986d6a0db784ae7a036841a02b351.orig/src/import/Makefile
+++ cri-tools-1.27.0+gite73a7139ed4986d6a0db784ae7a036841a02b351/src/import/Makefile
@@ -74,7 +74,8 @@
 	@$(MAKE) -B $(CRICTL)
 
 $(CRICTL):
-	CGO_ENABLED=$(CGO_ENABLED) $(GO_BUILD) -o $@ \
+	$(GO_BUILD) -o $@ \
+		-a -pkgdir dontusecurrentpkgs \
 		-ldflags '$(GO_LDFLAGS)' \
 		$(GOFLAGS) \
 		$(PROJECT)/cmd/crictl