Building Go code on the target fails because `go env` contains CC assignments which include --sysroot: go build runtime/cgo: arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/andy/yocto/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/go/1.14.7-r0/recipe-sysroot: fork/exec arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/andy/yocto/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/go/1.14.7-r0/recipe-sysroot: no such file or directory That's the build sysroot, so obviously shouldn't be used on target. https://github.com/golang/go/issues/8161 is a related upstream bug, but appears to be saying "the user should work around this" instead of actually fixing the bug.
Not much call for using go on target.
Ross, it appears we can close this issue. I just did a build on master of core-image-minimal with "go" and "go-dev" added to the image. I haven't dug around to see what has changed but to help cleanup the bug backlog when you have a chance could you retest and withdraw the bug if you get similar results? --- root@qemux86-64:~# cat main.go package main import "fmt" func main() { fmt.Println("hello world") } root@qemux86-64:~# go build main.go root@qemux86-64:~# ./main hello world root@qemux86-64:~# go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/root/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/root/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib64/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib64/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18.2" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2590820835=/tmp/go-build -gno-record-gcc-switches" root@qemux86-64:~# ---
Good enough for me, thanks Mark.