Bug 12704

Summary: Go fails to build on older hosts
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: devtools / tool chainAssignee: Matt Madison <matt>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: matt, meta.mr.watcher, meta.watcher, otavio, richard.purdie
Version: 2.5   
Target Milestone: 2.5 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2018-04-20 14:50:16 UTC
ERROR: go-runtime-1.9.4-r0 do_compile: Function failed: do_compile (log file is located at /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/work/i586-poky-linux/go-runtime/1.9.4-r0/temp/log.do_compile.54340)
...
| ##### Building Go toolchain using /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/work/i586-poky-linux/go-runtime/1.9.4-r0/recipe-sysroot-native/usr/lib/go.
| # runtime/cgo
| gcc: error: unrecognized command line option ‘-fstack-protector-strong’


Looks like it's trying to use the host compiler with target CFLAGS, which isn't right.

This broke a test-M4 build so hopefully we can get this fixed asap.

https://autobuilder.yocto.io/builders/nightly-world-lsb/builds/941/steps/BuildImages/logs/stdio
Comment 1 Matt Madison 2018-04-21 06:16:19 UTC
The issue is specifically with CGO_CFLAGS and CGO_LDFLAGS, which are being set in go-runtime.inc to the target values.  For the go 1.10 runtime build, that's the right setting, since it only builds target binaries.  That's not good for the go 1.9 runtime build, though, since it builds the host binaries before building the target binaries.

Overriding those settings on the host-side invocation of make.bash should take care of this.