From 80d83eacda410377e36d6e90db4f07d71888adbb Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 15 Oct 2020 10:52:22 -0400 Subject: containerd: fix x86-64 build 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: containerd-opencontainers/v1.4.1+gitAUTOINC+e44e8ebeaa-r0/git/src/import/cmd/containerd-shim cannot find package runtime/cgo (using -importcfg) containerd-opencontainers/v1.4.1+gitAUTOINC+e44e8ebeaa-r0/recipe-sysroot-native/usr/lib/x86_64-overc-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. Signed-off-by: Bruce Ashfield --- recipes-containers/containerd/containerd.inc | 2 +- .../containerd/files/0001-build-use-oe-provided-GO-and-flags.patch | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'recipes-containers/containerd') diff --git a/recipes-containers/containerd/containerd.inc b/recipes-containers/containerd/containerd.inc index 1f8ce47a..319e1981 100644 --- a/recipes-containers/containerd/containerd.inc +++ b/recipes-containers/containerd/containerd.inc @@ -64,7 +64,7 @@ do_compile() { export BUILDTAGS="no_btrfs static_build netgo" export CFLAGS="${CFLAGS}" export LDFLAGS="${LDFLAGS}" - export SHIM_CGO_ENABLED=${CGO_ENABLED} + export SHIM_CGO_ENABLED="${CGO_ENABLED}" cd ${S}/src/import oe_runmake binaries diff --git a/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch b/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch index a709d125..a58feed1 100644 --- a/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch +++ b/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch @@ -54,17 +54,17 @@ Index: git/src/import/Makefile 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=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim -+ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim ++ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build -a -pkgdir dontusecurrentpkgs ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim bin/containerd-shim-runc-v1: cmd/containerd-shim-runc-v1 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-runc-v1" - @CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1 -+ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1 ++ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build -a -pkgdir dontusecurrentpkgs ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1 bin/containerd-shim-runc-v2: cmd/containerd-shim-runc-v2 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-runc-v2" - @CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2 -+ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2 ++ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build -a -pkgdir dontusecurrentpkgs ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2 binaries: $(BINARIES) ## build binaries @echo "$(WHALE) $@" -- cgit v1.2.3-54-g00ecf