[Buildroot] [PATCH v1 1/1] package/go: use host compiler when go-bootstrap unsupported

Christian Stewart christian at paral.in
Sat Jul 24 20:50:28 UTC 2021


Hi Thomas, all,

On Wed, Jul 21, 2021 at 1:49 PM Thomas Petazzoni
<thomas.petazzoni at bootlin.com> wrote:
> Christian Stewart <christian at paral.in> wrote:
> > The problem is that step 2 - build go-bootstrap - does not work on 64-bit arm.
> > The Go compiler from 1.4.x is compatible with x86, x86_64, and arm (32 bit).
>
> So perhaps my brain is not smart enough here, but how is the Go
> compiler then build on 64-bit ARM ?

It has to be bootstrapped using an existing arm64 go compiler binary,
or cross compiled.

Presumably a bootstrap process which produces first an armv7 Go
compiler, and then uses it to build a arm64 Go compiler, is also
possible.

With gccgo, it should be possible to bootstrap using the Gcc version
of the Go compiler (which is included with the Buildroot toolchain
today, but not enabled.)

> The one thing that bothers me however is the hardcoding of /usr/lib/go
> in your proposal as the location of the Go compiler. I guess we could
> have some logic in the top-level Makefile that looks for the path of
> the host Go compiler perhaps ?

Yes, it could be done like this:

PATH_TO_GOROOT=$(go env GOROOT)

> Does this make sense ?

Yes, this should work fine.

Eventually the gccgo based bootstrap approach could also be added as
another alternative.

Best regards,
Christian Stewart


More information about the buildroot mailing list