diff options
Diffstat (limited to 'recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch')
-rw-r--r-- | recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch b/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch new file mode 100644 index 00000000..3b0c0a46 --- /dev/null +++ b/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From 09524d187ef108784c854a0c247ac6476a10bb67 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mark Asselstine <mark.asselstine@windriver.com> | ||
3 | Date: Mon, 18 Mar 2019 14:04:16 -0400 | ||
4 | Subject: [PATCH] Makefile: force rebuilding all packages to avoid cgo | ||
5 | |||
6 | We are running into an issue when attempting to build 'static', | ||
7 | similar to what is described by | ||
8 | |||
9 | https://plus.google.com/117192131596509381660/posts/eNnNePihYnK | ||
10 | and | ||
11 | https://github.com/golang/go/issues/9369 | ||
12 | |||
13 | In our case we can see that it manifests as a build error | ||
14 | |||
15 | cannot find package runtime/cgo (using -importcfg) | ||
16 | ...go/pkg/tool/linux_amd64/link: cannot open file : open : no such file or directory | ||
17 | |||
18 | Although the descriptions of issue indicate that newer versions of GO, | ||
19 | such as the version we are using, should not have this issue it is | ||
20 | clear from the error that cgo is being referenced when it should be | ||
21 | out of the picture. | ||
22 | |||
23 | Interesting enough this issue only manifests when we are building on | ||
24 | x86-64 and building for x86-64 which might indicate that GO might be | ||
25 | finding -native packages and not -cross packages. | ||
26 | |||
27 | This change works around the issue and will allow for the building of | ||
28 | the 'static' make target, but at this time and until the issue is | ||
29 | completely understood, it is recommended that the 'build' target is | ||
30 | used. | ||
31 | |||
32 | Upstream-Status: Inappropriate [only an issue with our builds] | ||
33 | |||
34 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> | ||
35 | --- | ||
36 | Makefile | 2 +- | ||
37 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
38 | |||
39 | diff --git a/Makefile b/Makefile | ||
40 | index 476cb9b..ecd0df4 100644 | ||
41 | --- a/src/import/Makefile | ||
42 | +++ b/src/import/Makefile | ||
43 | @@ -41,7 +41,7 @@ $(NAME): *.go VERSION.txt | ||
44 | .PHONY: static | ||
45 | static: ## Builds a static executable | ||
46 | @echo "+ $@" | ||
47 | - CGO_ENABLED=0 $(GO) build \ | ||
48 | + CGO_ENABLED=0 $(GO) build -a -pkgdir dontusecurrentpkgs \ | ||
49 | -tags "$(BUILDTAGS) static_build" \ | ||
50 | ${GO_LDFLAGS_STATIC} -o $(NAME) . | ||
51 | |||
52 | -- | ||
53 | 2.7.4 | ||
54 | |||