cni: fix problem about cross compilation
PATCH 1/2 cni: fix problem about cross compilation
When setting up k8s, the following error appeared, failing to setup coredns pod.
NetworkPlugin cni failed to set up pod "coredns-5f7fc64c95-4nnfq_kube-system" network: fork/exec /opt/cni/bin/loopback: no such file or directory
This is because the binary, /opt/cni/bin/loopback, has wrong interpreter.
So fix do_compile to use ${GO} instead of go to fix this problem.
Also clean up all unnecessary settings which have already been in go.bbclass.
--- recipes-networking/cni/cni_git.bb | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-)
recipes-networking/cni/cni_git.bb +3 -22
@@ -29,18 +29,6 @@ inherit go inherit goarch 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 mkdir -p ${S}/src/import/vendor/
@@ -56,19 +44,12 @@ do_compile() { ln -sf ${WORKDIR}/plugins ${S}/src/import/vendor/github.com/containernetworking/plugins 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/vendor/github.com/containernetworking/cni/libcni - go build + ${GO} build cd ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool - go build + ${GO} build cd ${S}/src/import/vendor/github.com/containernetworking/plugins/ PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/main/* | grep -v windows)"
@@ -76,7 +57,7 @@ do_compile() { for p in $PLUGINS; do plugin="$(basename "$p")" echo "building: $p" - go build -o ${WORKDIR}/plugins/bin/$plugin github.com/containernetworking/plugins/$p + ${GO} build -o ${WORKDIR}/plugins/bin/$plugin github.com/containernetworking/plugins/$p done }
Signature · 1 line
2.17.1
PATCH 2/2 cni: build more plugins
Also build plugins under ipam. Other distros default to contain these plugins.
--- recipes-networking/cni/cni_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-networking/cni/cni_git.bb +1 -1
@@ -52,7 +52,7 @@ do_compile() { ${GO} build cd ${S}/src/import/vendor/github.com/containernetworking/plugins/ - PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/main/* | grep -v windows)" + PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls -d plugins/main/* | grep -v windows)" mkdir -p ${WORKDIR}/plugins/bin/ for p in $PLUGINS; do plugin="$(basename "$p")"
Signature · 1 line
2.17.1
Quoted 7 lines · Chen Qi
When setting up k8s, the following error appeared, failing to setup coredns pod.
NetworkPlugin cni failed to set up pod
"coredns-5f7fc64c95-4nnfq_kube-system" network: fork/exec/opt/cni/bin/loopback: no such file or directory
Quoted 7 lines
This is because the binary,
/opt/cni/bin/loopback, has wrong interpreter.So fix
do_compileto use ${GO} instead of go to fix this problem.Also clean up all unnecessary settings which have already been in go.bbclass.
These need to be separate patches.
In particular, I want the CGO_ENABLED flag to remain, as well as GOPATH, since on uprev, I'm constantly tweaking them.
Bruce
Quoted 80 lines
Signed-off-by Chen Qi <[email protected]>--- recipes-networking/cni/cni_git.bb | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-)recipes-networking/cni/ renamed from recipes-networking/cni/cni_git.bb +0
-0cni_git.bb
index d07154b..f392ea6 100644recipes-networking/cni/cni_git.bb +0
-14@@ -29,18 +29,6 @@ inherit go inherit goarch 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 mkdir -p ${S}/src/import/vendor/@@ -56,19 +44,12 @@ do_compile() { ln -sf ${WORKDIR}/plugins ${S}/src/import/vendor/github.com/containernetworking/plugins
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"recipes-networking/cni/cni_git.bb +0
-6- - # 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/vendor/github.com/containernetworking/cni/libcni
recipes-networking/cni/cni_git.bb +1
-1- go build + ${GO} build cd ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
recipes-networking/cni/cni_git.bb +1
-1- go build + ${GO} build cd ${S}/src/import/vendor/github.com/containernetworking/plugins/ PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/main/* | grep -vwindows)"
recipes-networking/cni/cni_git.bb +0
-1@@ -76,7 +57,7 @@ do_compile() { for p in $PLUGINS; do plugin="$(basename "$p")" echo "building: $p" - go build -o ${WORKDIR}/plugins/bin/$plugingithub.com/containernetworking/plugins/$p
+ ${GO} build -o ${WORKDIR}/plugins/bin/$plugin
github.com/containernetworking/plugins/$p
done
}--
2.17.1--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization
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