Message ID | 20240307015107.2908128-2-christian@aperture.us |
---|---|
State | Accepted |
Headers | show |
Series | [v1,1/3] package/go-bootstrap-stage2: bump version to go1.19.13 | expand |
On 07/03/2024 02:51, Christian Stewart via buildroot wrote: > Add a third bootstrap stage with Go1.21.x necessary for go1.22 bootstrap. > > go-bootstrap-stage1 is Go1.4.x, the final version to support bootstrap using a C > compiler (later versions require the Go compiler for bootstrapping). > > See: https://go.dev/doc/install/source#bootstrapFromSource > > go-bootstrap-stage2 is Go 1.19.13, the last version to support bootstrap using > the Go1.4.x compiler. > > go-bootstrap-stage3 is Go 1.21.8, the last version to support bootstrap using > the Go1.19.13 compiler. Go 1.20 requires a minimum of go 1.17.13 to bootstrap. > > See: https://go.dev/doc/go1.20#bootstrap > > This patch is in preparation for bumping the host-go package to >go1.22.x, which > requires a minimum of Go1.20.x for bootstrap. > > See: https://go.dev/doc/go1.22#bootstrap > > Signed-off-by: Christian Stewart <christian@aperture.us> > --- > DEVELOPERS | 1 + > package/Config.in.host | 1 + > package/go-bootstrap-stage3/Config.in.host | 4 ++ > .../go-bootstrap-stage3.hash | 3 ++ > .../go-bootstrap-stage3.mk | 53 +++++++++++++++++++ > 5 files changed, 62 insertions(+) > create mode 100644 package/go-bootstrap-stage3/Config.in.host > create mode 100644 package/go-bootstrap-stage3/go-bootstrap-stage3.hash > create mode 100644 package/go-bootstrap-stage3/go-bootstrap-stage3.mk > > diff --git a/DEVELOPERS b/DEVELOPERS > index a6364cdd44..abcf29b2fc 100644 > --- a/DEVELOPERS > +++ b/DEVELOPERS > @@ -595,6 +595,7 @@ F: package/fuse-overlayfs/ > F: package/go/ > F: package/go-bootstrap-stage1/ > F: package/go-bootstrap-stage2/ > +F: package/go-bootstrap-stage3/ > F: package/gocryptfs/ > F: package/mbpfan/ > F: package/moby-buildkit/ > diff --git a/package/Config.in.host b/package/Config.in.host > index f03ca16b7b..9543a22ffc 100644 > --- a/package/Config.in.host > +++ b/package/Config.in.host > @@ -46,6 +46,7 @@ menu "Host utilities" > source "package/go/Config.in.host" > source "package/go-bootstrap-stage1/Config.in.host" > source "package/go-bootstrap-stage2/Config.in.host" > + source "package/go-bootstrap-stage3/Config.in.host" > source "package/google-breakpad/Config.in.host" > source "package/gptfdisk/Config.in.host" > source "package/imagemagick/Config.in.host" > diff --git a/package/go-bootstrap-stage3/Config.in.host b/package/go-bootstrap-stage3/Config.in.host > new file mode 100644 > index 0000000000..1714c2fb15 > --- /dev/null > +++ b/package/go-bootstrap-stage3/Config.in.host > @@ -0,0 +1,4 @@ > +config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS > + bool > + default y > + depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE2_ARCH_SUPPORTS > diff --git a/package/go-bootstrap-stage3/go-bootstrap-stage3.hash b/package/go-bootstrap-stage3/go-bootstrap-stage3.hash > new file mode 100644 > index 0000000000..b1aed10c7c > --- /dev/null > +++ b/package/go-bootstrap-stage3/go-bootstrap-stage3.hash > @@ -0,0 +1,3 @@ > +# From https://go.dev/dl > +sha256 dc806cf75a87e1414b5b4c3dcb9dd3e9cc98f4cfccec42b7af617d5a658a3c43 go1.21.8.src.tar.gz > +sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE > diff --git a/package/go-bootstrap-stage3/go-bootstrap-stage3.mk b/package/go-bootstrap-stage3/go-bootstrap-stage3.mk > new file mode 100644 > index 0000000000..553256bcb8 > --- /dev/null > +++ b/package/go-bootstrap-stage3/go-bootstrap-stage3.mk > @@ -0,0 +1,53 @@ > +################################################################################ > +# > +# go-bootstrap-stage3 > +# > +################################################################################ > + > +# Use last Go version that go-bootstrap-stage2 can build: v1.21.x > +# See https://go.dev/doc/go1.22#bootstrap > +GO_BOOTSTRAP_STAGE3_VERSION = 1.21.8 > +GO_BOOTSTRAP_STAGE3_SITE = https://storage.googleapis.com/golang > +GO_BOOTSTRAP_STAGE3_SOURCE = go$(GO_BOOTSTRAP_STAGE3_VERSION).src.tar.gz > + > +GO_BOOTSTRAP_STAGE3_LICENSE = BSD-3-Clause > +GO_BOOTSTRAP_STAGE3_LICENSE_FILES = LICENSE > + > +# Use go-bootstrap-stage2 to bootstrap. > +HOST_GO_BOOTSTRAP_STAGE3_DEPENDENCIES = host-go-bootstrap-stage2 > + > +HOST_GO_BOOTSTRAP_STAGE3_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE3_VERSION) > + > +# The go build system is not compatible with ccache, so use > +# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685. > +HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV = \ > + GO111MODULE=off \ > + GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE2_ROOT) \ > + GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE3_ROOT) \ > + GOROOT="$(@D)" \ > + GOBIN="$(@D)/bin" \ > + GOOS=linux \ > + CC=$(HOSTCC_NOCCACHE) \ > + CXX=$(HOSTCXX_NOCCACHE) \ > + CGO_ENABLED=0 When trying to build in the context of the runtime tests, I get this error: cd /home/tmp/brtest/TestMender/build/host-go-bootstrap-stage3-1.21.8/src && GO111MODULE=off GOROOT_BOOTSTRAP=/home/tmp/brtest/TestMender/host/lib/go-1.19.13 GOROOT_FINAL=/home/tmp/brtest/TestMender/host/lib/go-1.21.8 GOROOT="/home/tmp/brtest/TestMender/build/host-go-bootstrap-stage3-1.21.8" GOBIN="/home/tmp/brtest/TestMender/build/host-go-bootstrap-stage3-1.21.8/bin" GOOS=linux CC=/usr/bin/gcc CXX=/usr/bin/g++ CGO_ENABLED=0 ./make.bash Building Go cmd/dist using /home/tmp/brtest/TestMender/host/lib/go-1.19.13. (go1.19.13 linux/amd64) build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined I suspect that we need either GOCACHE=$(HOST_GO_HOST_CACHE) or GOCACHE=(some other path). I tested with the first option and that seems to work. So I made that change and committed. Let's see if the autobuilders complain... Regards, Arnout > + > +define HOST_GO_BOOTSTRAP_STAGE3_BUILD_CMDS > + cd $(@D)/src && \ > + $(HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v) > +endef > + > +define HOST_GO_BOOTSTRAP_STAGE3_INSTALL_CMDS > + $(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/go > + $(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/gofmt > + > + cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/ > + > + mkdir -p $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg > + cp -a $(@D)/pkg/include $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/ > + cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/ > + > + # The Go sources must be installed to the host/ tree for the Go stdlib. > + cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/ > +endef > + > +$(eval $(host-generic-package))
Hi Arnout, On Mon, Mar 25, 2024 at 3:36 PM Arnout Vandecappelle <arnout@mind.be> wrote: > When trying to build in the context of the runtime tests, I get this error: > > cd /home/tmp/brtest/TestMender/build/host-go-bootstrap-stage3-1.21.8/src && > GO111MODULE=off GOROOT_BOOTSTRAP=/home/tmp/brtest/TestMender/host/lib/go-1.19.13 > GOROOT_FINAL=/home/tmp/brtest/TestMender/host/lib/go-1.21.8 > GOROOT="/home/tmp/brtest/TestMender/build/host-go-bootstrap-stage3-1.21.8" > GOBIN="/home/tmp/brtest/TestMender/build/host-go-bootstrap-stage3-1.21.8/bin" > GOOS=linux CC=/usr/bin/gcc CXX=/usr/bin/g++ CGO_ENABLED=0 ./make.bash > Building Go cmd/dist using /home/tmp/brtest/TestMender/host/lib/go-1.19.13. > (go1.19.13 linux/amd64) > build cache is required, but could not be located: GOCACHE is not defined and > neither $XDG_CACHE_HOME nor $HOME are defined > > I suspect that we need either GOCACHE=$(HOST_GO_HOST_CACHE) or GOCACHE=(some > other path). I tested with the first option and that seems to work. So I made > that change and committed. Let's see if the autobuilders complain... Sounds like the right fix to me, thanks! Christian
diff --git a/DEVELOPERS b/DEVELOPERS index a6364cdd44..abcf29b2fc 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -595,6 +595,7 @@ F: package/fuse-overlayfs/ F: package/go/ F: package/go-bootstrap-stage1/ F: package/go-bootstrap-stage2/ +F: package/go-bootstrap-stage3/ F: package/gocryptfs/ F: package/mbpfan/ F: package/moby-buildkit/ diff --git a/package/Config.in.host b/package/Config.in.host index f03ca16b7b..9543a22ffc 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -46,6 +46,7 @@ menu "Host utilities" source "package/go/Config.in.host" source "package/go-bootstrap-stage1/Config.in.host" source "package/go-bootstrap-stage2/Config.in.host" + source "package/go-bootstrap-stage3/Config.in.host" source "package/google-breakpad/Config.in.host" source "package/gptfdisk/Config.in.host" source "package/imagemagick/Config.in.host" diff --git a/package/go-bootstrap-stage3/Config.in.host b/package/go-bootstrap-stage3/Config.in.host new file mode 100644 index 0000000000..1714c2fb15 --- /dev/null +++ b/package/go-bootstrap-stage3/Config.in.host @@ -0,0 +1,4 @@ +config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS + bool + default y + depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE2_ARCH_SUPPORTS diff --git a/package/go-bootstrap-stage3/go-bootstrap-stage3.hash b/package/go-bootstrap-stage3/go-bootstrap-stage3.hash new file mode 100644 index 0000000000..b1aed10c7c --- /dev/null +++ b/package/go-bootstrap-stage3/go-bootstrap-stage3.hash @@ -0,0 +1,3 @@ +# From https://go.dev/dl +sha256 dc806cf75a87e1414b5b4c3dcb9dd3e9cc98f4cfccec42b7af617d5a658a3c43 go1.21.8.src.tar.gz +sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE diff --git a/package/go-bootstrap-stage3/go-bootstrap-stage3.mk b/package/go-bootstrap-stage3/go-bootstrap-stage3.mk new file mode 100644 index 0000000000..553256bcb8 --- /dev/null +++ b/package/go-bootstrap-stage3/go-bootstrap-stage3.mk @@ -0,0 +1,53 @@ +################################################################################ +# +# go-bootstrap-stage3 +# +################################################################################ + +# Use last Go version that go-bootstrap-stage2 can build: v1.21.x +# See https://go.dev/doc/go1.22#bootstrap +GO_BOOTSTRAP_STAGE3_VERSION = 1.21.8 +GO_BOOTSTRAP_STAGE3_SITE = https://storage.googleapis.com/golang +GO_BOOTSTRAP_STAGE3_SOURCE = go$(GO_BOOTSTRAP_STAGE3_VERSION).src.tar.gz + +GO_BOOTSTRAP_STAGE3_LICENSE = BSD-3-Clause +GO_BOOTSTRAP_STAGE3_LICENSE_FILES = LICENSE + +# Use go-bootstrap-stage2 to bootstrap. +HOST_GO_BOOTSTRAP_STAGE3_DEPENDENCIES = host-go-bootstrap-stage2 + +HOST_GO_BOOTSTRAP_STAGE3_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE3_VERSION) + +# The go build system is not compatible with ccache, so use +# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685. +HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV = \ + GO111MODULE=off \ + GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE2_ROOT) \ + GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE3_ROOT) \ + GOROOT="$(@D)" \ + GOBIN="$(@D)/bin" \ + GOOS=linux \ + CC=$(HOSTCC_NOCCACHE) \ + CXX=$(HOSTCXX_NOCCACHE) \ + CGO_ENABLED=0 + +define HOST_GO_BOOTSTRAP_STAGE3_BUILD_CMDS + cd $(@D)/src && \ + $(HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v) +endef + +define HOST_GO_BOOTSTRAP_STAGE3_INSTALL_CMDS + $(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/go + $(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/gofmt + + cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/ + + mkdir -p $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg + cp -a $(@D)/pkg/include $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/ + cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/ + + # The Go sources must be installed to the host/ tree for the Go stdlib. + cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/ +endef + +$(eval $(host-generic-package))
Add a third bootstrap stage with Go1.21.x necessary for go1.22 bootstrap. go-bootstrap-stage1 is Go1.4.x, the final version to support bootstrap using a C compiler (later versions require the Go compiler for bootstrapping). See: https://go.dev/doc/install/source#bootstrapFromSource go-bootstrap-stage2 is Go 1.19.13, the last version to support bootstrap using the Go1.4.x compiler. go-bootstrap-stage3 is Go 1.21.8, the last version to support bootstrap using the Go1.19.13 compiler. Go 1.20 requires a minimum of go 1.17.13 to bootstrap. See: https://go.dev/doc/go1.20#bootstrap This patch is in preparation for bumping the host-go package to >go1.22.x, which requires a minimum of Go1.20.x for bootstrap. See: https://go.dev/doc/go1.22#bootstrap Signed-off-by: Christian Stewart <christian@aperture.us> --- DEVELOPERS | 1 + package/Config.in.host | 1 + package/go-bootstrap-stage3/Config.in.host | 4 ++ .../go-bootstrap-stage3.hash | 3 ++ .../go-bootstrap-stage3.mk | 53 +++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 package/go-bootstrap-stage3/Config.in.host create mode 100644 package/go-bootstrap-stage3/go-bootstrap-stage3.hash create mode 100644 package/go-bootstrap-stage3/go-bootstrap-stage3.mk