Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Christian Stewart via buildroot <buildroot@buildroot.org>
Cc: "Yann E . MORIN" <yann.morin.1998@free.fr>
Subject: Re: [Buildroot] [PATCH v3 3/3] package/go: use host compiler when go-bootstrap unsupported
Date: Sun, 12 Mar 2023 23:04:02 +0100	[thread overview]
Message-ID: <20230312230402.50be40b1@windsurf> (raw)
In-Reply-To: <20230215073256.186476-3-christian@paral.in>

Hello Christian,

On Tue, 14 Feb 2023 23:32:56 -0800
Christian Stewart via buildroot <buildroot@buildroot.org> wrote:

> The process for "bootstrapping" the Go compiler in Buildroot is:
> 
> 1. Compile a C/C++ cross-compiler (gcc) as the host toolchain.

I find "host toolchain" confusing here. I generally understand "host
toolchain" as "native toolchain".

> diff --git a/package/go/go.mk b/package/go/go.mk
> index 4db703a301..68f6d9e36b 100644
> --- a/package/go/go.mk
> +++ b/package/go/go.mk
> @@ -12,7 +12,6 @@ GO_LICENSE = BSD-3-Clause
>  GO_LICENSE_FILES = LICENSE
>  GO_CPE_ID_VENDOR = golang
>  
> -HOST_GO_DEPENDENCIES = host-go-bootstrap-stage2
>  HOST_GO_GOPATH = $(HOST_DIR)/share/go-path
>  HOST_GO_HOST_CACHE = $(HOST_DIR)/share/host-go-cache
>  HOST_GO_ROOT = $(HOST_DIR)/lib/go
> @@ -109,6 +108,11 @@ else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
>  HOST_GO_CGO_ENABLED = 1
>  endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
>  
> +ifeq ($(HOST_GO_CGO_ENABLED),1)
> +# For cgo support the toolchain needs to be available.
> +HOST_GO_DEPENDENCIES += toolchain
> +endif

Why is this added as part of this commit? It seems completely
unrelated. And in fact, shouldn't this be the correct thing to do
instead of what PATCH 1/3 is doing with the toolchain dependency added
on host-go-bootstrap-stage2 ?

> diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
> index 4353e9585e..943c7d0daf 100755
> --- a/support/dependencies/dependencies.sh
> +++ b/support/dependencies/dependencies.sh
> @@ -217,6 +217,10 @@ if grep -q ^BR2_NEEDS_HOST_UTF8_LOCALE=y $BR2_CONFIG ; then
>  	fi
>  fi
>  
> +if grep -q ^BR2_NEEDS_HOST_GO=y $BR2_CONFIG ; then
> +	check_prog_host "go"
> +fi

I think this is missing a version check on go: you need at least go
1.17.x to be able to build a go >= 1.20. The check as written here does
not check the go version.

Also, I am wondering if we couldn't improve things a bit and use an
already installed (and sufficiently recent) Go compiler to save on
building host-go-bootstrap-stage{1,2} even on architectures where the
full bootstrap build is supported.

We would have the following cases:

 - Architecture supported by bootstrap-stage{1,2}

   - If system-provided Go is available and recent enough => use it and skip bootstrap
   - If not, do bootstrapping

 - Architecture not supported by bootstrap-stage{1,2}

   - If system-provided Go is available and recent enough => use it
   - If not, should not happen due to check

It is of course not mandatory to implement this right now. It would be
a nice to have, but not a must have for sure.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-03-12 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  7:32 [Buildroot] [PATCH v3 1/3] package/go-bootstrap: split into two stages: go1.4 and go1.19.5 Christian Stewart via buildroot
2023-02-15  7:32 ` [Buildroot] [PATCH v3 2/3] package/go: bump to version 1.20.1 Christian Stewart via buildroot
2023-02-15  7:32 ` [Buildroot] [PATCH v3 3/3] package/go: use host compiler when go-bootstrap unsupported Christian Stewart via buildroot
2023-03-12 22:04   ` Thomas Petazzoni via buildroot [this message]
2023-03-12 21:58 ` [Buildroot] [PATCH v3 1/3] package/go-bootstrap: split into two stages: go1.4 and go1.19.5 Thomas Petazzoni via buildroot
2023-03-24  2:45   ` Christian Stewart via buildroot
2023-03-31 10:24     ` Thomas Petazzoni via buildroot
2023-03-25 13:34 ` Bagas Sanjaya
2023-03-25 13:39   ` Bagas Sanjaya
2023-03-25 16:54   ` Christian Stewart via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230312230402.50be40b1@windsurf \
    --to=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox