I’m trying to build an image of logspout on MacOS for RPi3/armv7 from this repo/branch:
I’ve added a simple hello test to run through, because it also doesn’t build correctly but I can’t identify the problem (whether it’s docker or go or what). I’m on MacOS 10.14.6, running Docker Desktop Edge 2.1.4.0 (arm support).
If you checkout that repo/branch and run this, it will build fine:
#7 16.03 Linux buildkitsandbox 4.14.131-linuxkit #1 SMP Fri Jul 19 12:31:17 UTC 2019 armv7l Linux
#7 17.32 # command-line-arguments
#7 17.32 runtime: pointer 0xa00020 to unused region of span span.base()=0x800000 span.limit=0x801ff0 span.state=1
#7 17.32 runtime: found in object at *(0xfffc5008+0x7fe8)
#7 17.32 object=0xfffc5008 s=nil
#7 17.32 fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)
So I wanted to see if I could use one of Balena’s images using cross-build-start, this one runs fine:
Linux 7f692e18a736 4.14.131-linuxkit #1 SMP Fri Jul 19 12:31:17 UTC 2019 armv7l Linux
# command-line-arguments
runtime: pointer 0xa00020 to unused region of span span.base()=0x800000 span.limit=0x809f00 span.state=1
runtime: found in object at *(0xfffc5008+0x7fe8)
object=0xfffc5008 s=nil
fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)
Any ideas on what’s going on? Or even where the problem is so I can open a ticket there?
Yes, I noticed that, just wanted to flag this here because all of the arm/docker code is built around qemu and I had never heard anyone talking about incompatibilities within it. Should I raise this issue with qemu then?
I guess.
Not sure if it should be on go or qemu.
I couldn’t find anyone reporting this issue on the Internet.
The closest thing I’ve found is https://github.com/golang/go/issues/19135 but it’s on an older version of go (1.8) and cross compiling from mac amd64 to mac i386.
Hi, I searched for similar issues reported on GitHub and I could find plenty reported on the Go lang repo. Please check whether you are running latest Go version and if that still does not work, I think the Go lang repo is the best place to report this.
Just to add two things I discovered yesterday while poking around a little bit more. I decided to try this with ubuntu instead of alpine, and everything built/compiled correctly on the same MacOS/Docker combo that doesn’t work with the alpine image. I created another branch here:
I also created a real armv7 server at scaleway and ran the ORIGINAL alpine branch code, and as noted by @zvin above, everything ran and compiled correctly. I even checked across that alpine docker image and the image that is being pulled by docker on MacOS, and it’s pulling the same one:
That server was running this version of Ubuntu:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
Linux scw-elastic-mclaren 4.4.127-mainline-rev1 #1 SMP Sun Apr 8 10:33:17 UTC 2018 armv7l armv7l armv7l GNU/Linux
Docker version 18.09.0, build 4d60db4
I also tried changing the build image to arm32v7/alpine:latest on MacOS/Docker buildx, but that also failed (I was reading some places that alpine didn’t have real armv7 support?)
So not sure what this narrows it down to? An issue between Alpine/qemu and the linux kernel that comes with MacOS Docker? Linux buildkitsandbox 4.14.131-linuxkit #1 SMP Fri Jul 19 12:31:17 UTC 2019 armv7l Linux
Maybe the next step I will try is to get it to compile using the Docker CE edge buildx stuff on x86 ubuntu to see if it has the same problems? If it works correctly there, then it’s not a qemu problem but something specific to the MacOS docker kernel?
Possibly the difference is because Alpine uses musl libc instead of glibc. It is worth trying to build that on Ubuntu indeed. I still think it falls into the area of Go language itself though because it deals with those low level allocations. Here is an example recent commit: https://github.com/golang/go/commit/813d8e886208e5e001df3b55e8bc1c65ca4249ff