Skip to contentSkip to conversation

package/go: go-bin host-go provider implies target support

PATCH Superseded Tom Wambold 2 participants 10 messages Mar 14, 2025 – Oct 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/go: go-bin host-go provider implies target support

The BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS configuration symbol is used to determine if we can build Go packages for the target architecture. Previously, this depended *only* on the BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS symbol, which is true only if the host system can bootstrap the Go compiler.

The go-bin package makes it unnecessary to bootstrap the Go compiler. Also, some host architectures (i.e. arm64/aarch64) don't support bootstrapping the compiler anyway.

Add a new symbol BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS to let BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS depend on either being able to bootstrap the compiler *OR* using the go-bin package. This fixes being able to use the Go compiler to build target packages on an arm64/aarch64 host system.

---
 package/go/Config.in.host        | 2 +-
 package/go/go-bin/Config.in.host | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
package/go/Config.in.host +1 -1
index 7e354b3298..f9b27cc4d8 100644
@@ -2,7 +2,7 @@
 config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS
 	# See https://go.dev/doc/install/source#environment
 	# See src/go/build/syslist.go for the list of supported architectures
 	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
package/go/go-bin/Config.in.host +5 -0
index 6312c1b950..5fe1686fef 100644
@@ -12,3 +12,8 @@ config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
 	bool
 	default y
 	depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""
+
+config BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS
+	bool
+	default y
+	depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""
Signature · 6 lines
2.48.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 1/1 package/go: go-bin host-go provider implies target support

The BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS configuration symbol is used to determine if we can build Go packages for the target architecture. Previously, this depended *only* on the BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS symbol, which is true only if the host system can bootstrap the Go compiler.

The go-bin package makes it unnecessary to bootstrap the Go compiler. Also, some host architectures (i.e. arm64/aarch64) don't support bootstrapping the compiler anyway.

Add a new symbol BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS to let BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS depend on either being able to bootstrap the compiler *OR* using the go-bin package. This fixes being able to use the Go compiler to build target packages on an arm64/aarch64 host system.

---
Changes v1 -> v2:
- Added missing Signed-off-by

---
 package/go/Config.in.host        | 2 +-
 package/go/go-bin/Config.in.host | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
package/go/Config.in.host +1 -1
index 7e354b3298..f9b27cc4d8 100644
@@ -2,7 +2,7 @@
 config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS
 	# See https://go.dev/doc/install/source#environment
 	# See src/go/build/syslist.go for the list of supported architectures
 	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
package/go/go-bin/Config.in.host +5 -0
index 6312c1b950..5fe1686fef 100644
@@ -12,3 +12,8 @@ config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
 	bool
 	default y
 	depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""
+
+config BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS
+	bool
+	default y
+	depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello Tom,

Thanks for your patch! I must admit for this change I really would like to have the feedback from Christian. Christian, could you review and provide your feedback? This patch allows to use Go packages on ARM64 hosts, where the go-bootstrap1 -> go-boostrap2 -> go-bootstrap3 -> go-src solution isn't available as go-bootstrap1 is only supported on i386, x86-64 and arm (32-bit).

Tom: I however have a comment below.

Quoted 44 lines · On Mon, 31 Mar 2025 11:34:37 -0400 Tom Wambold <[email protected]> wrote:

The BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS configuration symbol is used to determine if we can build Go packages for the target architecture. Previously, this depended *only* on the BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS symbol, which is true only if the host system can bootstrap the Go compiler.

The go-bin package makes it unnecessary to bootstrap the Go compiler. Also, some host architectures (i.e. arm64/aarch64) don't support bootstrapping the compiler anyway.

Add a new symbol BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS to let BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS depend on either being able to bootstrap the compiler *OR* using the go-bin package. This fixes being able to use the Go compiler to build target packages on an arm64/aarch64 host system.

---
Changes v1 -> v2:
- Added missing Signed-off-by

---
 package/go/Config.in.host        | 2 +-
 package/go/go-bin/Config.in.host | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
package/go/Config.in.host +1 -1
index 7e354b3298..f9b27cc4d8 100644
@@ -2,7 +2,7 @@
 config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS
 	# See https://go.dev/doc/install/source#environment
 	# See src/go/build/syslist.go for the list of supported architectures
 	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
package/go/go-bin/Config.in.host +0 -0
index 6312c1b950..5fe1686fef 100644

package/go/go-bin/Config.in.host config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS · line 19

Quoted 8 lines
package/go/go-bin/Config.in.host +5 -0
@@ -12,3 +12,8 @@ config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
 	bool
 	default y
 	depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""
+
+config BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS
+	bool
+	default y
+	depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""

I think you don't need the new BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS, which is actually misleading as this option doesn't represent which target architecture are represented.

And in fact if you look at BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS it's defined like this:

config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
bool
default y
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS # See https://go.dev/doc/install/source#environment
# See src/go/build/syslist.go for the list of supported architectures depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
|| BR2_i386 || BR2_x86_64 || BR2_powerpc64le \
|| BR2_mips64 || BR2_mips64el || BR2_riscv || BR2_s390x
depends on !BR2_ARM_CPU_ARMV4
# MIPS R6 support in Go has not yet been developed. depends on !BR2_MIPS_CPU_MIPS64R6
# Go doesn't support Risc-v 32-bit.
depends on !BR2_RISCV_32
# Go requires the following Risc-v General (G) features:
depends on !BR2_riscv || (BR2_RISCV_ISA_RVI && \
BR2_RISCV_ISA_RVM && BR2_RISCV_ISA_RVA && \
BR2_RISCV_ISA_RVF && BR2_RISCV_ISA_RVD)

The "depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS" allows to verify that we are on a host where bootstraping is possible. And then the remaining dependencies are about making sure the target architecture is supported.

So I think I would rather do:

config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
bool
default y
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS # See https://go.dev/doc/install/source#environment
# See src/go/build/syslist.go for the list of supported architectures
depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
|| BR2_i386 || BR2_x86_64 || BR2_powerpc64le \
|| BR2_mips64 || BR2_mips64el || BR2_riscv || BR2_s390x
depends on !BR2_ARM_CPU_ARMV4
# MIPS R6 support in Go has not yet been developed.
depends on !BR2_MIPS_CPU_MIPS64R6
# Go doesn't support Risc-v 32-bit.
depends on !BR2_RISCV_32
# Go requires the following Risc-v General (G) features:
depends on !BR2_riscv || (BR2_RISCV_ISA_RVI && \
BR2_RISCV_ISA_RVM && BR2_RISCV_ISA_RVA && \
BR2_RISCV_ISA_RVF && BR2_RISCV_ISA_RVD)

This basically extends the thing to say: "In order to build Go packages for the target, we need:

1. A compiler that runs on our host: either bootstrapped, or pre-compiled (go-bin)

2. A target architecture that's supported
"

Tom, Christian, what do you think?

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hello,

Quoted 9 lines · On Sun, 18 May 2025 14:14:52 +0200 Thomas Petazzoni…

This basically extends the thing to say: "In order to build Go packages for the target, we need:

1. A compiler that runs on our host: either bootstrapped, or pre-compiled (go-bin)

2. A target architecture that's supported
"

Tom, Christian, what do you think?

FYI, I tried my proposal, and it does work: I was able to build a Go package (tinifier) for the ARM architecture, on an ARM64 host (on which bootstrapping Go is not possible).

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Thomas Petazzoni via buildroot

Hello Thomas:

Quoted 4 lines · Thomas Petazzoni

I think you don't need the new BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS, which is actually misleading as this option doesn't represent which target architecture are represented.

Thanks for the feedback! I've just sent a v3 with your suggestion.

I think originally I understood the BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS symbol as "this can build binaries for the host" and the BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS symbol as saying "this can build binaries for the target". It definitely makes sense to remove, especially since both symbols were defined exactly the same way.

Thanks again!
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
In reply to Thomas Petazzoni via buildroot

Hi Tom, Thomas,

Quoted 9 lines · Thomas Petazzoni

Hello Tom,

Thanks for your patch! I must admit for this change I really would like to have the feedback from Christian. Christian, could you review and provide your feedback? This patch allows to use Go packages on ARM64 hosts, where the go-bootstrap1 -> go-boostrap2 -> go-bootstrap3 -> go-src solution isn't available as go-bootstrap1 is only supported on i386, x86-64 and arm (32-bit).

Overall lgtm and I can test this out as well. Will have a look at it on Monday.

This one slipped through the cracks, apologies for the delay!

Best,
Christian Stewart
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

Hello Christian:

Quoted 3 lines · Christian Stewart

Overall lgtm and I can test this out as well. Will have a look at it on Monday.

This one slipped through the cracks, apologies for the delay!

Just a quick bump. Any chance this could get applied soon?

Understand about delays, I forgot about this too!

Thanks again.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Reviewed-by Christian Stewart
#7 lore raw

Hi all,

Quoted 11 lines · Tom Wambold

Hello Christian:

Quoted 3 lines · Christian Stewart

Overall lgtm and I can test this out as well. Will have a look at it on Monday.

This one slipped through the cracks, apologies for the delay!

Just a quick bump. Any chance this could get applied soon?

Understand about delays, I forgot about this too!

Looks good to me.

Thanks!

This one: https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw

PATCH v3 1/1 package/go: go-bin host-go provider implies target support

In reply to Tom Wambold

The BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS configuration symbol is used to determine if we can build Go packages for the target architecture. Previously, this depended *only* on the BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS symbol, which is true only if the host system can bootstrap the Go compiler.

The go-bin package makes it unnecessary to bootstrap the Go compiler. Also, some host architectures (i.e. arm64/aarch64) don't support bootstrapping the compiler anyway.

Update BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS to depend on either being able to bootstrap the compiler *OR* using the go-bin package. This fixes being able to use the Go compiler to build target packages on an arm64/aarch64 host system.

---
Changes v1 -> v2:
- Added missing Signed-off-by

Changes v2 -> v3:
- Remove new BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS symbol, and just re-use the HOST_ARCH_SUPPORTS symbol. They were always the same value anyway. Thanks for the feedback @[email protected]!

---
 package/go/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/go/Config.in.host +1 -1
index 7e354b3298..a42e37f90b 100644
@@ -2,7 +2,7 @@
 config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
 	# See https://go.dev/doc/install/source#environment
 	# See src/go/build/syslist.go for the list of supported architectures
 	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Hello,

Looks like this patch has been superseeded by 432cf9be9f43b26dbe7856feb3295b8e25c85048.

Best regards,
PERALE Thomas

In reply of:

Quoted 51 lines

The BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS configuration symbol is used to determine if we can build Go packages for the target architecture. Previously, this depended *only* on the BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS symbol, which is true only if the host system can bootstrap the Go compiler.

The go-bin package makes it unnecessary to bootstrap the Go compiler. Also, some host architectures (i.e. arm64/aarch64) don't support bootstrapping the compiler anyway.

Update BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS to depend on either being able to bootstrap the compiler *OR* using the go-bin package. This fixes being able to use the Go compiler to build target packages on an arm64/aarch64 host system.

---
Changes v1 -> v2:
- Added missing Signed-off-by

Changes v2 -> v3:
- Remove new BR2_PACKAGE_HOST_GO_BIN_TARGET_ARCH_SUPPORTS symbol, and just re-use the HOST_ARCH_SUPPORTS symbol. They were always the same value anyway. Thanks for the feedback @[email protected]!

---
 package/go/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/go/Config.in.host +1 -1
index 7e354b3298..a42e37f90b 100644
@@ -2,7 +2,7 @@
 config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
 	# See https://go.dev/doc/install/source#environment
 	# See src/go/build/syslist.go for the list of supported architectures
 	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot