Skip to contentSkip to conversation

docker/containerd: Export GOARCH to fix build in arm64

PATCH In review Aníbal Limón 2 participants 2 messages Oct 6, 2017 – Oct 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docker/containerd: Export GOARCH to fix build in arm64

From: Aníbal Limón <[email protected]>

If the GOARCH isn't set CGO took the ARCH from the host and tries to use -m64 flag that isn't available in aarch64 compiler.

...
| # github.com/opencontainers/runc/libcontainer/system
| aarch64-linaro-linux-gcc: error: unrecognized command line option '-m64'
| # github.com/containerd/console
| aarch64-linaro-linux-gcc: error: unrecognized command line option '-m64'
| Makefile:60: recipe for target 'shim-static' failed
...

---
 recipes-containers/containerd/containerd.inc | 1 +
 recipes-containers/docker/docker_git.bb      | 1 +
 2 files changed, 2 insertions(+)
recipes-containers/containerd/containerd.inc +1 -0
index 18d9188..e7a3719 100644
@@ -38,6 +38,7 @@ do_compile() {
 
 	# Pass the needed cflags/ldflags so that cgo
 	# can find the needed headers files and libraries
+	export GOARCH="${TARGET_GOARCH}"
 	export CGO_ENABLED="1"
 	export CFLAGS=""
 	export LDFLAGS=""
recipes-containers/docker/docker_git.bb +1 -0
index 4d6c17c..d2dce76 100644
@@ -97,6 +97,7 @@ do_compile() {
 
 	# Pass the needed cflags/ldflags so that cgo
 	# can find the needed headers files and libraries
+        export GOARCH=${TARGET_GOARCH}
 	export CGO_ENABLED="1"
 	export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
Signature · 1 line
2.11.0
#1 lore raw

merged.

Bruce

Quoted 48 lines · Aníbal Limón

From: Aníbal Limón <[email protected]>

If the GOARCH isn't set CGO took the ARCH from the host and tries to use -m64 flag that isn't available in aarch64 compiler.

...
| # github.com/opencontainers/runc/libcontainer/system
| aarch64-linaro-linux-gcc: error: unrecognized command line option '-m64'
| # github.com/containerd/console
| aarch64-linaro-linux-gcc: error: unrecognized command line option '-m64'
| Makefile:60: recipe for target 'shim-static' failed
...

---
 recipes-containers/containerd/containerd.inc | 1 +
 recipes-containers/docker/docker_git.bb      | 1 +
 2 files changed, 2 insertions(+)
recipes-containers/containerd/containerd.inc +1 -0
index 18d9188..e7a3719 100644
@@ -38,6 +38,7 @@ do_compile() {
 
        # Pass the needed cflags/ldflags so that cgo
        # can find the needed headers files and libraries
+       export GOARCH="${TARGET_GOARCH}"
        export CGO_ENABLED="1"
        export CFLAGS=""
        export LDFLAGS=""
recipes-containers/docker/docker_git.bb +1 -1
index 4d6c17c..d2dce76 100644
@@ -97,6 +97,7 @@ do_compile() {
 
        # Pass the needed cflags/ldflags so that cgo
        # can find the needed headers files and libraries
+        export GOARCH=${TARGET_GOARCH}
        export CGO_ENABLED="1"
        export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
--

2.11.0

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"