Skip to contentSkip to conversation

package/go: make pre-built compiler provide target support too

PATCH Superseded Florian Larysch 3 participants 13 messages Jun 11, 2025 – Aug 14, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/go: make pre-built compiler provide target support too

Currently, BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS, which transitively depends on stage1 bootstrapping support, which is only present for x86/x86_64 and arm.

When building on a host system which doesn't support a full bootstrap (like aarch64), we can fall back on the pre-built toolchain. However, in that case, those symbols are all false, making the internal state of the build system inconsistent. In particular, this causes none of the environment variables like GOARCH to be set and thus the Go compiler will perform a native build instead of a cross build.

Fix this by also allowing BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS to fulfill the dependency.

---
 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
#1 lore raw

Hello Florian,

Adding Yann in Cc (Go infra related topic)

Le 11/06/2025 à 18:21, Florian Larysch a écrit :

Quoted 4 lines

Currently, BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS, which transitively depends on stage1 bootstrapping support, which is only present for x86/x86_64 and arm.

Ok.

Quoted 7 lines

When building on a host system which doesn't support a full bootstrap (like aarch64), we can fall back on the pre-built toolchain. However, in that case, those symbols are all false, making the internal state of the build system inconsistent. In particular, this causes none of the environment variables like GOARCH to be set and thus the Go compiler will perform a native build instead of a cross build.

I don't understand this part. Since BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is not set on aarch64 build machine, we can't enable any go packages for the target. We can only install host-go-bin (which is useless in this case).

Quoted 3 lines

Fix this by also allowing BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS to fulfill the dependency.

This would fix this commit [1] from Buildroot 2024.11, so it should be backported.

[1]
https://gitlab.com/buildroot.org/buildroot/-/commit/7b2a164b7460c07471080fe565bf5da76b032e59

Best regards,
Romain

Quoted 11 lines
---
 package/go/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/go/Config.in.host +0 -0
index 7e354b3298..a42e37f90b 100644

package/go/Config.in.host line 8

Quoted 8 lines
package/go/Config.in.host +1 -1
@@ -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 \

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

#2 lore raw

Hello Romain,

thanks for taking a look!

Quoted 10 lines · Romain Naour
Quoted 6 lines

When building on a host system which doesn't support a full bootstrap (like aarch64), we can fall back on the pre-built toolchain. However, in that case, those symbols are all false, making the internal state of the build system inconsistent. In particular, this causes none of the environment variables like GOARCH to be set and thus the Go compiler will perform a native build instead of a cross build.

I don't understand this part. Since BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is not set on aarch64 build machine, we can't enable any go packages for the target.

Exactly, that's the problem I'm trying to solve here.

Quoted 1 line

We can only install host-go-bin (which is useless in this case).

It isn't useless because this is the cross-compiler that enables us to build packages for the target. Whether we do a full bootstrap via BR2_PACKAGE_HOST_GO_SRC or get the pre-built binary via BR2_PACKAGE_HOST_GO_BIN, the result is the same kind of host-go.

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

#3 lore raw

Hello Florian,

Le 06/07/2025 à 19:13, Florian Larysch a écrit :

Quoted 16 lines

Hello Romain,

thanks for taking a look!

Quoted 10 lines · Romain Naour
Quoted 6 lines

When building on a host system which doesn't support a full bootstrap (like aarch64), we can fall back on the pre-built toolchain. However, in that case, those symbols are all false, making the internal state of the build system inconsistent. In particular, this causes none of the environment variables like GOARCH to be set and thus the Go compiler will perform a native build instead of a cross build.

I don't understand this part. Since BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is not set on aarch64 build machine, we can't enable any go packages for the target.

Quoted 8 lines

Exactly, that's the problem I'm trying to solve here.

Quoted 1 line

We can only install host-go-bin (which is useless in this case).

It isn't useless because this is the cross-compiler that enables us to build packages for the target. Whether we do a full bootstrap via BR2_PACKAGE_HOST_GO_SRC or get the pre-built binary via BR2_PACKAGE_HOST_GO_BIN, the result is the same kind of host-go.

I believe there is an misunderstanding here.

When you say "we can fall back on the pre-built toolchain", we indeed fall back on the pre-built go cross-toolchain (host-go) but since BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is missing, host-go can't be used to build go target packages (even if it's installed in HOST_DIR).

Since it's a pre-built toolchain there is no native build involved. As you explained, the full bootstrap via BR2_PACKAGE_HOST_GO_SRC is not supported on aarch64 hosts.

With your patch applied, we can now use host-go (provided by host-go-bin) on aaarch64 hosts to build go target packages. I'm agree with your changes, it's just the commit log that needs to be reworded (with the link to the commit adding host-go-bin package).

Best regards,
Romain

Quoted 2 lines

Florian

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

#4 lore raw

Hello Romain,

Quoted 1 line · Romain Naour

I believe there is an misunderstanding here.

Yeah and I'm afraid you've lost me completely now, sorry. :(

Quoted 5 lines

When you say "we can fall back on the pre-built toolchain", we indeed fall back on the pre-built go cross-toolchain (host-go) but since BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is missing, host-go can't be used to build go target packages (even if it's installed in HOST_DIR).

Quoted 8 lines

Since it's a pre-built toolchain there is no native build involved. As you explained, the full bootstrap via BR2_PACKAGE_HOST_GO_SRC is not supported on aarch64 hosts.

With your patch applied, we can now use host-go (provided by host-go-bin) on aaarch64 hosts to build go target packages. I'm agree with your changes, it's just the commit log that needs to be reworded (with the link to the commit adding host-go-bin package).

As I read it, this is more or less what the commit message is already saying. Can you please explain where you think it is incorrect or imprecise?

The only reference to a native build in the commit message is when it is describing the current broken state that causes a native build of target packages to happen erroneously.

I can of course add the link.

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

#5 lore raw

Florian, All,

On 2025-07-07 17:43 +0200, Florian Larysch spake thusly:

Quoted 3 lines · Romain Naour
Quoted 1 line

I believe there is an misunderstanding here.

Yeah and I'm afraid you've lost me completely now, sorry. :(

To be honest, I also got slightly lost. I agree with Romain that the original commit message was not entirely clear (I had to read it very carefully to get it, but then I'm still waiting for my cafeine shot to kick in...)

But also I'm not sure I entirely groked Romain's comments either. ;-p

So, I've had a go (aha!) at rewriting a commit log as I understood the situation, building upon your initial commit log and trying to account for Romain's comments:

---8<---
All go packages must depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS, which ensures that we do have a go compiler available for that target.

Now, BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is restricted to the availability of a host go bootstrap, i.e. that the build machine can bootstrap a go compiler.

However, there are architectures which can not bootstrap a go compiler, but for which exist pre-built go toolchains; this is the case, for example, of AArch64.

Thus, currently, on an AArch64 host, we can't build go packages (for target or host), because we can't bootstrap a go compiler.

It is to be noted that a single go compiler can generate code for all the architectures supported by go. When host-go-bin was added in commit 7b2a164b7460 (package/go/go-bin: new host-go provider), the host depenency was properly accounted for: it is already possible to build host-go packages with go-bin. However, the fact that a go compiler, in addition to its native target, can also generate code for all supported architectures, was missed at the time.

We fix that by relaxing the condition under which BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is set, by allowing go-bin along go-bootstrap. This allows a situation where the host can't bootstrap, but for which there is a pre-built toolchain, to build go packages for a supported target.
---8<---

I hope that is clearer and fits the bill. If I missed anything, don;t hesitate to amend/fix/ditch that proposal.

Regards,
Yann E. MORIN.

Quoted 25 lines
Quoted 5 lines

When you say "we can fall back on the pre-built toolchain", we indeed fall back on the pre-built go cross-toolchain (host-go) but since BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is missing, host-go can't be used to build go target packages (even if it's installed in HOST_DIR).

Quoted 8 lines

Since it's a pre-built toolchain there is no native build involved. As you explained, the full bootstrap via BR2_PACKAGE_HOST_GO_SRC is not supported on aarch64 hosts.

With your patch applied, we can now use host-go (provided by host-go-bin) on aaarch64 hosts to build go target packages. I'm agree with your changes, it's just the commit log that needs to be reworded (with the link to the commit adding host-go-bin package).

As I read it, this is more or less what the commit message is already saying. Can you please explain where you think it is incorrect or imprecise?

The only reference to a native build in the commit message is when it is describing the current broken state that causes a native build of target packages to happen erroneously.

I can of course add the link.

Florian

Signature · 23 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
|                 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
| yann.morin (at) orange.com           |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Hello Yann,

Quoted 3 lines · On Tue, Jul 08, 2025 at 07:04:22AM +0200, [email protected] wrote:

So, I've had a go (aha!) at rewriting a commit log as I understood the situation, building upon your initial commit log and trying to account for Romain's comments:

Thank you! That does seem more straightforward than the original message.

I think I now realize where the whole confusion was coming from: The package in question in our internal tree that made me discover this problem in the first place was missing the BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS dependency and thus enabling "go-bin" *seemed* to work but ended up just building the package for the host architecture. I didn't realize that this was caused by a packaging problem on our end and not a Buildroot issue (if the dependency had been correctly declared, the package would not have been selectable) and I ended up dragging this into my commit message (the part about native builds).

Either way, feel free to commit this with your reworded message. Or should I send a v2?

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

#7 lore raw

Florian, All,

On 2025-07-09 16:59 +0200, Florian Larysch spake thusly:

Quoted 6 lines · On Tue, Jul 08, 2025 at 07:04:22AM +0200, [email protected] wrote:
Quoted 3 lines

So, I've had a go (aha!) at rewriting a commit log as I understood the situation, building upon your initial commit log and trying to account for Romain's comments:

Thank you! That does seem more straightforward than the original message.

[--SNIP--]

Quoted 2 lines

Either way, feel free to commit this with your reworded message. Or should I send a v2?

I think you should just resubmit with the updated commit log. Do not forget to mention, below the '---' line, that is is a v2 that incorporates an extended commit log, e.g. something like:

Signed-off-by: Your NAME <your-email>
Cc: romain <email>
Cc: yann <email>
---
Changes v1 -> v2:
- rewrite commit log as suggested by Romain and Yann.

that way, it is easier for a future reviewer to follow what's going on.

Regards,
Yann E. MORIN.

Signature · 23 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
|                 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
| yann.morin (at) orange.com           |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

PATCH v2 1/1 package/go: make pre-built compiler provide target support too

In reply to Florian Larysch

All Go packages must depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS, which ensures that we do have a Go compiler available for that target.

BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is currently restricted to the availability of a full host Go compiler bootstrap. However, there are architectures like AArch64 for which a full bootstrap is not supported.

Thus, currently, on an AArch64 host, we can't build Go packages (for target or host), because we can't bootstrap a Go compiler.

However, note that a single Go compiler can generate code for all the architectures supported by Go and for some host architectures, there are pre-built toolchains available. When host-go-bin was added in commit 7b2a164b7460 ("package/go/go-bin: new host-go provider"), the host dependency was properly accounted for: It is already possible to build host-go packages with go-bin. However, the fact that a Go compiler, in addition to its native target, can also generate code for all supported architectures, was missed at the time.

Thus, we can fix this problem by relaxing the condition under which BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is set to allowing go-bin along with go-bootstrap. This allows a situation where the host can't bootstrap, but for which there is a pre-built toolchain to build Go packages for a supported target.

Cc Yann E. MORIN <[email protected]>
Cc Romain Naour <[email protected]>

---
v1->v2:
- Reworded commit message after discussion with Romain and Yann.

 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
Reviewed-by on v2 1/1
#10 lore raw
In reply to Florian Larysch

Florian, All,

On 2025-07-14 16:52 +0200, Florian Larysch spake thusly:

Quoted 25 lines

All Go packages must depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS, which ensures that we do have a Go compiler available for that target.

BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is currently restricted to the availability of a full host Go compiler bootstrap. However, there are architectures like AArch64 for which a full bootstrap is not supported.

Thus, currently, on an AArch64 host, we can't build Go packages (for target or host), because we can't bootstrap a Go compiler.

However, note that a single Go compiler can generate code for all the architectures supported by Go and for some host architectures, there are pre-built toolchains available. When host-go-bin was added in commit 7b2a164b7460 ("package/go/go-bin: new host-go provider"), the host dependency was properly accounted for: It is already possible to build host-go packages with go-bin. However, the fact that a Go compiler, in addition to its native target, can also generate code for all supported architectures, was missed at the time.

Thus, we can fix this problem by relaxing the condition under which BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is set to allowing go-bin along with go-bootstrap. This allows a situation where the host can't bootstrap, but for which there is a pre-built toolchain to build Go packages for a supported target.

Quoted 3 lines
Cc Yann E. MORIN <[email protected]>
Cc Romain Naour <[email protected]>

Thanks for the respin!

Regards,
Yann E. MORIN.

Quoted 23 lines

---
v1->v2:
- Reworded commit message after discussion with Romain and Yann.

 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 · 1 line
2.49.0
Signature · 23 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
|                 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
| yann.morin (at) orange.com           |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw

Hello Forian, Yann, All,

Le 29/07/2025 à 13:53, [email protected] a écrit :

Quoted 28 lines

Florian, All,

On 2025-07-14 16:52 +0200, Florian Larysch spake thusly:

Quoted 25 lines

All Go packages must depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS, which ensures that we do have a Go compiler available for that target.

BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is currently restricted to the availability of a full host Go compiler bootstrap. However, there are architectures like AArch64 for which a full bootstrap is not supported.

Thus, currently, on an AArch64 host, we can't build Go packages (for target or host), because we can't bootstrap a Go compiler.

However, note that a single Go compiler can generate code for all the architectures supported by Go and for some host architectures, there are pre-built toolchains available. When host-go-bin was added in commit 7b2a164b7460 ("package/go/go-bin: new host-go provider"), the host dependency was properly accounted for: It is already possible to build host-go packages with go-bin. However, the fact that a Go compiler, in addition to its native target, can also generate code for all supported architectures, was missed at the time.

Thus, we can fix this problem by relaxing the condition under which BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is set to allowing go-bin along with go-bootstrap. This allows a situation where the host can't bootstrap, but for which there is a pre-built toolchain to build Go packages for a supported target.

Quoted 7 lines
Quoted 3 lines
Cc Yann E. MORIN <[email protected]>
Cc Romain Naour <[email protected]>

Thanks for the respin!

+1 :)

Applied to master, thanks.

Best regards,
Romain

Quoted 11 lines

Regards,
Yann E. MORIN.

Quoted 7 lines

---
v1->v2:
- Reworded commit message after discussion with Romain and Yann.

 package/go/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 16 lines
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 · 1 line
2.49.0

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

#12 lore raw
In reply to Florian Larysch

In reply of:

Quoted 25 lines

All Go packages must depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS, which ensures that we do have a Go compiler available for that target.

BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is currently restricted to the availability of a full host Go compiler bootstrap. However, there are architectures like AArch64 for which a full bootstrap is not supported.

Thus, currently, on an AArch64 host, we can't build Go packages (for target or host), because we can't bootstrap a Go compiler.

However, note that a single Go compiler can generate code for all the architectures supported by Go and for some host architectures, there are pre-built toolchains available. When host-go-bin was added in commit 7b2a164b7460 ("package/go/go-bin: new host-go provider"), the host dependency was properly accounted for: It is already possible to build host-go packages with go-bin. However, the fact that a Go compiler, in addition to its native target, can also generate code for all supported architectures, was missed at the time.

Thus, we can fix this problem by relaxing the condition under which BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is set to allowing go-bin along with go-bootstrap. This allows a situation where the host can't bootstrap, but for which there is a pre-built toolchain to build Go packages for a supported target.

Quoted 3 lines
Cc Yann E. MORIN <[email protected]>
Cc Romain Naour <[email protected]>

Applied to 2025.02.x & 2025.05.x. Thanks

Quoted 27 lines

---
v1->v2:
- Reworded commit message after discussion with Romain and Yann.

 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