runc/containerd: fix build with go 1.9.x

go 1.9.x was triggering linkage errors on some build hosts due to
missing symbols.

   | tmp/work/core2-64-poky-linux/runc-docker/1.0.0-rc5+gitAUTOINC+4fc53a81fb-r0/recipe-sysroot/usr/lib/../lib/libc.a(dl-reloc-static-pie.o): In function `elf_mac:
   | /usr/src/debug/glibc/2.27-r0/git/sysdeps/x86_64/dl-machine.h:59: undefined reference to `_DYNAMIC'
   | tmp/work/core2-64-poky-linux/runc-docker/1.0.0-rc5+gitAUTOINC+4fc53a81fb-r0/recipe-sysroot/usr/lib/../lib/libc.a(dl-reloc-static-pie.o): In function `elf_get:
   | /usr/src/debug/glibc/2.27-r0/git/elf/get-dynamic-info.h:48: undefined reference to `_DYNAMIC'

By ensuring that our sysroot provided go binary and build flags make
it into the build enviroment we can build properly with 1.9 and 1.10

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Bruce Ashfield 2018-04-19 16:49:41 -04:00
parent 7d2ee2dfa2
commit fcc09c8c36
7 changed files with 37 additions and 31 deletions

View File

@ -1,6 +1,6 @@
SRCREV = "cfd04396dc68220d1cecbe686a6cc3aa5ce3667c"
SRC_URI = "git://github.com/containerd/containerd;nobranch=1 \
file://0001-containerd-shim-build-with-CGO.patch \
file://0001-build-use-oe-provided-GO-and-flags.patch \
"
include containerd.inc

View File

@ -53,6 +53,8 @@ do_compile() {
export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export BUILDTAGS="no_btrfs static_build netgo"
export CFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS}"
cd ${S}/src/import
oe_runmake binaries

View File

@ -1,7 +1,7 @@
From a1d2db9037b1302c4ce4cfc170a4fa443f68e594 Mon Sep 17 00:00:00 2001
From e31acef290181434efaf47e70db7ad0d92dbe300 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@windriver.com>
Date: Thu, 29 Mar 2018 15:48:41 -0400
Subject: [PATCH] containerd-shim: build with CGO
Date: Thu, 19 Apr 2018 17:09:51 -0400
Subject: [PATCH] build: use oe provided GO and flags
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
@ -9,7 +9,7 @@ Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/import/Makefile b/src/import/Makefile
index 9d8cf8a18fbc..1dff4e3c2043 100644
index 9d8cf8a18fbc..492d033fe2a7 100644
--- a/src/import/Makefile
+++ b/src/import/Makefile
@@ -134,7 +134,7 @@ bin/%: cmd/% FORCE
@ -17,7 +17,7 @@ index 9d8cf8a18fbc..1dff4e3c2043 100644
bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
@echo "$(WHALE) bin/containerd-shim"
- @CGO_ENABLED=0 go build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
+ @go build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
+ @$(GO) build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} $(GOBUILDFLAGS) ${GO_TAGS} ./cmd/containerd-shim
binaries: $(BINARIES) ## build binaries
@echo "$(WHALE) $@"

View File

@ -1,23 +0,0 @@
From aa2fc7b0eacba61175f083cc8d8adc233bcd0575 Mon Sep 17 00:00:00 2001
From: Paul Barker <pbarker@toganlabs.com>
Date: Thu, 12 Oct 2017 11:34:24 +0000
Subject: [PATCH] Disable building recvtty
Signed-off-by: Paul Barker <pbarker@toganlabs.com>
Upstream-status: Inappropriate
---
Makefile | 1 -
1 file changed, 1 deletion(-)
Index: git/src/import/Makefile
===================================================================
--- git.orig/src/import/Makefile
+++ git/src/import/Makefile
@@ -40,7 +40,6 @@
static: $(SOURCES)
CGO_ENABLED=1 $(GO) build $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo cgo static_build" -installsuffix netgo -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o runc .
- CGO_ENABLED=1 $(GO) build $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo cgo static_build" -installsuffix netgo -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
release:
script/release.sh -r release/$(VERSION) -v $(VERSION)

View File

@ -0,0 +1,27 @@
From a9a2b9e72027d0b2357f6dfe8b154762aaa8dd02 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@windriver.com>
Date: Thu, 19 Apr 2018 16:39:41 -0400
Subject: [PATCH] build: drop recvtty and use GOBUILDFLAGS
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
Makefile | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/import/Makefile b/src/import/Makefile
index c6de11d..0e9bddb 100644
--- a/src/import/Makefile
+++ b/src/import/Makefile
@@ -39,8 +39,7 @@ contrib/cmd/recvtty/recvtty: $(SOURCES)
$(GO) build -buildmode=pie $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
static: $(SOURCES)
- CGO_ENABLED=1 $(GO) build $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo cgo static_build" -installsuffix netgo -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o runc .
- CGO_ENABLED=1 $(GO) build $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo cgo static_build" -installsuffix netgo -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
+ CGO_ENABLED=1 $(GO) build -tags "$(BUILDTAGS) netgo cgo static_build" -installsuffix netgo -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" $(GOBUILDFLAGS) -o runc .
release:
script/release.sh -r release/$(VERSION) -v $(VERSION)
--
2.7.4

View File

@ -5,7 +5,7 @@ include runc.inc
SRCREV_runc-docker = "4fc53a81fb7c994640722ac585fa9ca548971871"
SRC_URI = "git://github.com/opencontainers/runc;nobranch=1;name=runc-docker \
file://0001-runc-Add-console-socket-dev-null.patch \
file://0001-Disable-building-recvtty.patch \
file://0001-build-drop-recvtty-and-use-GOBUILDFLAGS.patch \
file://0001-runc-docker-SIGUSR1-daemonize.patch \
"

View File

@ -51,7 +51,7 @@ do_compile() {
export CFLAGS=""
export LDFLAGS=""
oe_runmake static
oe_runmake static
}
do_install() {