[OE-core] [PATCH] go: Allow bootstrapping using host go compiler

Daniel Thompson daniel.thompson at linaro.org
Fri Apr 12 13:16:16 UTC 2019


On Fri, Apr 12, 2019 at 01:39:52PM +0100, Richard Purdie wrote:
> On Fri, 2019-04-12 at 13:30 +0100, Daniel Thompson wrote:
> > Currently go-native bootstraps without any dependency on the host go
> > compiler by building go-1.4 (the last version written in C) and using
> > that to build a more recent version of go. This does not work on host
> > architectures, such as arm64, that are not supported by go-1.4. To
> > support these host architectures we must rely on an existing host go
> > compiler and use that to build go-native instead.
> > 
> > Rather than add arm64 specific code that forces the use of the host
> > go
> > compiler, we use an architecture neutral approach based on adopting
> > the
> > host go compiler if it is both recent enough and the output of `go
> > env
> > GOROOT` passes basic sanity testing.
> > 
> > Signed-off-by: Daniel Thompson <daniel.thompson at linaro.org>
> > ---
> >  meta/conf/bitbake.conf                 |  4 +++
> >  meta/recipes-devtools/go/go-native.inc | 38
> > ++++++++++++++++++++++++--
> >  2 files changed, 39 insertions(+), 3 deletions(-)
> 
> Whilst this is quite a creative approach it isn't deterministic and I
> can see this introducing bugs which are hard to track down :(

I guess I can't disagree too strongly... the version check and bbplain
message about the go toolchain we adopted were intended to mitigate
this by at least making the selected go toolchain conspicious (and thus
a git blame would probably draw flames towards me).

We could make things fully deterministic by downloading go compiler
binaries (rather than source) if the host architecture is not supported
by go-1.4. Is this feasible or should I continue trying to adopt the
host go compiler for these architectures?


> I think we need to make this a specific configuration option.

I guess we could wrap this up in a config option although I hope
it is ok to have per-architecture defaults so the config option is
always sane out-of-the-box.


Daniel.


More information about the Openembedded-core mailing list