[Buildroot] [RFC] package/go: switch to gcc go instead of go-bootstrap

Christian Stewart christian at paral.in
Fri May 27 00:30:12 UTC 2022


Thomas,

On Thu, May 26, 2022 at 6:46 AM Thomas Petazzoni
<thomas.petazzoni at bootlin.com> wrote:
> On Thu, 26 May 2022 02:17:19 +0000
> Joel Stanley <joel at jms.id.au> wrote:
> > I use arm64 and ppc64le hosts for my buildrooting as they are the
> > fastest machines I have access to. Neither are supported by
> > go-bootstrap, so moving to gcc-go looks like a win for me.

> As Yann Morin suggested in another e-mail, maybe we need to support
> both situations:
>
>  * Building Go in 3 stages when using an external toolchain that
>    doesn't have Go support. This would mean building Go 1.4 with the C
>    compiler, then building Go 1.16 with Go 1.4, and finally building Go
>    latest with Go 1.16.
>
>  * Building Go in 2 stages with gcc-go when using an internal toolchain
>    (in which we can enable Go support) or an external toolchain that
>    has Go support.
>

As I also build on arm64 systems, I have a patch in my tree which
implements this:

https://github.com/skiffos/buildroot/commit/2df564c82081661f4a599998a276477929dd2a61

Previously submitted here (With your comments):

https://patchwork.ozlabs.org/project/buildroot/patch/20210622024337.3009417-1-christian@paral.in/

This implements using a host "/usr/bin/go" to bootstrap if
go-bootstrap cannot be built.

So there are actually three cases (in this priority order):

 - Build gccgo with buildroot toolchain -> golatest
 - Build go-bootstrap (C) with GCC -> go1.16 -> golatest
 - Build golatest relying on host /usr/bin/go installation.

Note that you can get the path to GOROOT with "$(go env GOROOT)"

So, we don't have to hardcode /usr/bin/go, but rather use whichever
"go" is in the PATH.

Thanks & best,
Christian Stewart



More information about the buildroot mailing list