cri-o: fixup build
PATCH 1/2 cri-o: fixup build
After oe-core commits
5f48939e2640 [goarch.bbclass: use MACHINEOVERRIDES and simplify go_map_arm()] 6300c4a83f7c [go.bbclass:Export more GO* environment variables]
we see a build failure with cri-o:
| go build runtime/cgo: attempting to install package runtime/cgo into read-only GOROOT | Makefile:112: recipe for target 'conmon/config.h' failed | make: *** [conmon/config.h] Error 1
to avoid this we should not overwrite the GO* environment being setup by the go.bbclass, so we drop most of our GO* exports here.
--- recipes-containers/cri-o/cri-o_git.bb | 19 ------------------- 1 file changed, 19 deletions(-)
recipes-containers/cri-o/cri-o_git.bb +0 -19
@@ -53,18 +53,8 @@ inherit pkgconfig EXTRA_OEMAKE="BUILDTAGS=''" do_compile() { - export GOARCH="${TARGET_GOARCH}" - export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" export GOPATH="${S}/src/import:${S}/src/import/vendor" - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CFLAGS="" - export LDFLAGS="" - export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - # link fixups for compilation rm -f ${S}/src/import/vendor/src ln -sf ./ ${S}/src/import/vendor/src
@@ -82,15 +72,6 @@ do_compile() { ln -sf ../../../../version ${S}/src/import/vendor/github.com/kubernetes-sigs/cri-o/version ln -sf ../../../../lib ${S}/src/import/vendor/github.com/kubernetes-sigs/cri-o/lib - export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" - export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" - - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - cd ${S}/src/import oe_runmake binaries
Signature · 1 line
2.7.4
PATCH 2/2 cri-o: build crio-config natively to generate conmon/config.h
Part of building cri-o is the generation of the 'conmon/config.h' file. The content of this file is dynamic in that it has buffer sizes and a socket path which will depend on constants that are set in other parts of the code. For example the socket path can be setup for Windows or for Linux.
To generate 'conmon/config.h' a small GO application is built and run called crio-config. This isn't really suitable for a -native package but we do have to run crio-config on the build host so we don't want to cross compile it. We therefor use the native GO to build this. This change allows things to work when the build host arch and the target arch don't match. A small update to the Makefile avoids mixing build host arch and target arch GO packages.
Finally, We drop the crio-config binary from the install as it is only used to create the conmon/config.h as part of the build. This is consistent with the Makefile's install rule which does not install this binary as it has no use on the target.
--- recipes-containers/cri-o/cri-o_git.bb | 8 +++- ...skip-install-when-generating-the-config.h.patch | 43 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 recipes-containers/cri-o/files/Makefile-skip-install-when-generating-the-config.h.patch
recipes-containers/cri-o/cri-o_git.bb +7 -1
@@ -18,6 +18,7 @@ SRCREV_cri-o = "b986e6a8d2af34451363492479d2671a68fd20a3" SRC_URI = "\ git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.13;name=cri-o \ file://0001-Makefile-force-symlinks.patch \ + file://Makefile-skip-install-when-generating-the-config.h.patch \ file://crio.conf \ "
@@ -74,6 +75,12 @@ do_compile() { cd ${S}/src/import + # Build conmon/config.h, requires native versions of + # cmd/crio-config/config.go and oci/oci.go + (CGO_ENABLED=0 GO=go GOARCH=${BUILD_GOARCH} GOOS=${BUILD_GOOS} oe_runmake conmon/config.h) + rm -f bin/crio-config + rm -rf vendor/pkg + oe_runmake binaries }
@@ -96,7 +103,6 @@ do_install() { install -m 755 -D ${S}/src/import/test/testdata/* ${D}/${sysconfdir}/crio/config/ install ${S}/src/import/bin/crio ${D}/${localbindir} - install ${S}/src/import/bin/crio-config ${D}/${localbindir} install ${S}/src/import/bin/conmon ${D}/${localbindir}/crio install ${S}/src/import/bin/pause ${D}/${localbindir}/crio
recipes-containers/cri-o/files/Makefile-skip-install-when-generating-the-config.h.patch new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.7.4
Looks sane to me, and I was able to build it here.
Merged.
Bruce
Quoted 61 lines · Mark Asselstine
After oe-core commits
5f48939e2640[goarch.bbclass: use MACHINEOVERRIDES and simplifygo_map_arm()]6300c4a83f7c[go.bbclass:Export more GO* environment variables]we see a build failure with cri-o:
| go build runtime/cgo: attempting to install package runtime/cgo into read-only GOROOT | Makefile:112: recipe for target 'conmon/config.h' failed | make: *** [conmon/config.h] Error 1to avoid this we should not overwrite the GO* environment being setup by the go.bbclass, so we drop most of our GO* exports here.
Signed-off-by Mark Asselstine <[email protected]>--- recipes-containers/cri-o/cri-o_git.bb | 19 ------------------- 1 file changed, 19 deletions(-)recipes-containers/cri-o/cri-o_git.bb +0
-20@@ -53,18 +53,8 @@ inherit pkgconfig EXTRA_OEMAKE="BUILDTAGS=''" do_compile() { - export GOARCH="${TARGET_GOARCH}" - export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" export GOPATH="${S}/src/import:${S}/src/import/vendor" - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CFLAGS="" - export LDFLAGS="" - export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - # link fixups for compilation rm -f ${S}/src/import/vendor/src ln -sf ./ ${S}/src/import/vendor/src@@ -82,15 +72,6 @@ do_compile() { ln -sf ../../../../version ${S}/src/import/vendor/github.com/kubernetes-sigs/cri-o/version ln -sf ../../../../lib ${S}/src/import/vendor/github.com/kubernetes-sigs/cri-o/lib - export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" - export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" - - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - cd ${S}/src/import oe_runmake binaries --2.7.4
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II