aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-08-07 23:46:58 -0400
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-08-07 23:46:58 -0400
commit62a39b48a8c48c6eae1ad889c0f7a935221fe010 (patch)
tree7782f84ebc19473cd9be9e12c600877c9fee3785
parentcbf47a093dc20f0d1a25a3a2d7eec433767b947c (diff)
downloadmeta-virtualization-master.tar.gz
meta-virtualization-master.tar.bz2
meta-virtualization-master.zip
go-build: fix build with new go-binary bootstrapped toolchainHEADmaster
We need to be more explicity in our exports and use of 'go' to build properly with the new binary bootstrapped go toolchain. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch33
-rw-r--r--recipes-devtools/go/go-build_git.bb18
2 files changed, 49 insertions, 2 deletions
diff --git a/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch b/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch
new file mode 100644
index 0000000..36d45b5
--- /dev/null
+++ b/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch
@@ -0,0 +1,33 @@
+From 4db28c98481056c41097f808335c37e8517fe485 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Fri, 7 Aug 2020 23:39:18 -0400
+Subject: [PATCH] build: use instead of 'go'
+
+While we can get away with 'go' if the host/target arch match, the
+new go-binary toolchain blows up in a cross compile situation.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ gobuild/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/import/gobuild/Makefile b/src/import/gobuild/Makefile
+index 694d9ce..149d573 100644
+--- a/src/import/gobuild/Makefile
++++ b/src/import/gobuild/Makefile
+@@ -19,10 +19,10 @@ dep: ${GODEPPATHS}
+
+ ${GODEPPATHS}:
+ mkdir -p ${GOSRC}
+- GOPATH=${GOPATH} go get $(subst ${GOSRC}/,,$@)
++ GOPATH=${GOPATH} ${GO} get $(subst ${GOSRC}/,,$@)
+
+ ${BIN}: ${GODEPPATHS} $(filter %/$@.go, ${MAIN})
+- GOPATH=${GOPATH} ${ARCH} go build $(filter %/$@.go, ${MAIN})
++ GOPATH=${GOPATH} ${ARCH} ${GO} build $(filter %/$@.go, ${MAIN})
+
+ clean:
+ rm -f ${BIN}
+--
+2.19.1
+
diff --git a/recipes-devtools/go/go-build_git.bb b/recipes-devtools/go/go-build_git.bb
index e057b6d..3ac8608 100644
--- a/recipes-devtools/go/go-build_git.bb
+++ b/recipes-devtools/go/go-build_git.bb
@@ -8,6 +8,7 @@ SRCREV_runc = "e4363b038787addfa12e8b0acf5417d4fba01693"
SRC_URI = "\
git://github.com/lf-edge/runx;nobranch=1;name=runx \
git://github.com/opencontainers/runc.git;nobranch=1;destsuffix=runc;name=runc \
+ file://0001-build-use-instead-of-go.patch \
"
SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b"
SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769"
@@ -34,9 +35,22 @@ do_compile() {
export GOARCH="${TARGET_GOARCH}"
cd ${S}/src/import/gobuild
mkdir -p go/src/github.com/opencontainers
- ln -s ${WORKDIR}/runc ${S}/src/import/gobuild/go/src/github.com/opencontainers/runc
+ ln -sf ${WORKDIR}/runc ${S}/src/import/gobuild/go/src/github.com/opencontainers/runc
export GOPATH="${S}/src/import/gobuild/go/src/github.com/opencontainers/runc"
- oe_runmake
+
+ # Build the target binaries
+ export GOARCH="${TARGET_GOARCH}"
+ # 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}"
+ export CFLAGS=""
+ export LDFLAGS=""
+ export CC="${CC}"
+ export LD="${LD}"
+ export GOBIN=""
+
+ oe_runmake GO=${GO}
}
do_install() {