* [PATCH] go-cross-canadian: fix binaries install and GOARCH
@ 2025-08-08 16:15 Osama Abdelkader
2025-08-08 17:10 ` [OE-core] " Alexander Kanavin
0 siblings, 1 reply; 6+ messages in thread
From: Osama Abdelkader @ 2025-08-08 16:15 UTC (permalink / raw)
To: openembedded-core; +Cc: Osama Abdelkader
Canadian cross builds produce host-side binaries (x86_64), but
GOARCH=arm was leaking in from go-${PV}.inc/go-common.inc, causing
arch mismatch and package QA errors. Explicitly set GOARCH = "${HOST_GOARCH}" to
ensure the correct host architecture is used.
Also fix do_install to correctly install all binaries from
${GO_BUILD_BINDIR} by using 'find -type f' to avoid issues when the
directory contains subdirectories (e.g. "linux_arm").
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
meta/recipes-devtools/go/go-cross-canadian.inc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc
index 39330fc98b..4a6f2f4c36 100644
--- a/meta/recipes-devtools/go/go-cross-canadian.inc
+++ b/meta/recipes-devtools/go/go-cross-canadian.inc
@@ -5,6 +5,8 @@ DEPENDS = "go-native virtual/${HOST_PREFIX}go virtual/nativesdk-${HOST_PREFIX}go
virtual/nativesdk-compilerlibs"
PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+GOARCH = "${HOST_GOARCH}"
+
# it uses gcc on build machine during go-cross-canadian bootstrap, but
# the gcc version may be old and not support option '-fmacro-prefix-map'
# which is one of default values of DEBUG_PREFIX_MAP
@@ -51,7 +53,7 @@ do_install() {
install -d ${D}${libdir}/go/pkg/tool
cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/
install -d ${D}${bindir} ${D}${libdir}/go/bin
- for f in ${B}/${GO_BUILD_BINDIR}/*
+ for f in $(find ${B}/${GO_BUILD_BINDIR} -type f)
do
base=`basename $f`
install -m755 $f ${D}${libdir}/go/bin
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [OE-core] [PATCH] go-cross-canadian: fix binaries install and GOARCH
2025-08-08 16:15 [PATCH] go-cross-canadian: fix binaries install and GOARCH Osama Abdelkader
@ 2025-08-08 17:10 ` Alexander Kanavin
2025-08-08 20:55 ` Osama Abdelkader
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2025-08-08 17:10 UTC (permalink / raw)
To: osama.abdelkader; +Cc: openembedded-core
On Fri, 8 Aug 2025 at 18:16, Osama Abdelkader via
lists.openembedded.org
<osama.abdelkader=gmail.com@lists.openembedded.org> wrote:
>
> Canadian cross builds produce host-side binaries (x86_64), but
> GOARCH=arm was leaking in from go-${PV}.inc/go-common.inc, causing
> arch mismatch and package QA errors. Explicitly set GOARCH = "${HOST_GOARCH}" to
> ensure the correct host architecture is used.
> +GOARCH = "${HOST_GOARCH}"
This looks like it is set to the build host architecture, you probably
need to set this to the architecture of the SDK?
Basically, if your machine is x86_64, set SDKMACHINE to arm64 and
target MACHINE to qemuriscv64. Then everything should still work
correctly.
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] go-cross-canadian: fix binaries install and GOARCH
2025-08-08 17:10 ` [OE-core] " Alexander Kanavin
@ 2025-08-08 20:55 ` Osama Abdelkader
2025-08-11 8:47 ` [OE-core] " Alexander Kanavin
0 siblings, 1 reply; 6+ messages in thread
From: Osama Abdelkader @ 2025-08-08 20:55 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 128 bytes --]
setting SDKMACHINE and MACHINE didn't work for me.
If it did work for you, can you type the exact command(s) to try?
Osama
[-- Attachment #2: Type: text/html, Size: 4318 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OE-core] [PATCH] go-cross-canadian: fix binaries install and GOARCH
2025-08-08 20:55 ` Osama Abdelkader
@ 2025-08-11 8:47 ` Alexander Kanavin
2025-08-11 22:22 ` Osama Ahmed
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2025-08-11 8:47 UTC (permalink / raw)
To: osama.abdelkader; +Cc: openembedded-core
You need to show what you did, and what didn't work. I am unable to
commit time to come up with exact steps that I verified myself. But I
can correct your steps if you show them.
Alex
On Fri, 8 Aug 2025 at 22:55, Osama Abdelkader via
lists.openembedded.org
<osama.abdelkader=gmail.com@lists.openembedded.org> wrote:
>
> setting SDKMACHINE and MACHINE didn't work for me.
> If it did work for you, can you type the exact command(s) to try?
>
> Osama
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#221668): https://lists.openembedded.org/g/openembedded-core/message/221668
> Mute This Topic: https://lists.openembedded.org/mt/114603001/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OE-core] [PATCH] go-cross-canadian: fix binaries install and GOARCH
2025-08-11 8:47 ` [OE-core] " Alexander Kanavin
@ 2025-08-11 22:22 ` Osama Ahmed
2025-08-12 19:52 ` Alexander Kanavin
0 siblings, 1 reply; 6+ messages in thread
From: Osama Ahmed @ 2025-08-11 22:22 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1723 bytes --]
If you set MACHINE to qemuriscv64 it will be go-cross-canadian-riscv64, the
bugs were reported for arm/arm64 not riscv64
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15204
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15775
Also, the majority of Yocto SDK users run on *x86_64* workstations, so
SDKMACHINE=x86_64 is the primary supported path
and go-cross-canadian-aarch64 is supposed to work for any supported
SDKMACHINE, as long as the host architecture is valid.
Currently, if SDKMACHINE=x86_64 (the default for x86 PCs) building
go-cross-canadian-aarch64 fails,
with this patch build pass for both SDKMACHINE=x86_64 or aarch64.
Osama
On Mon, Aug 11, 2025 at 10:47 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:
> You need to show what you did, and what didn't work. I am unable to
> commit time to come up with exact steps that I verified myself. But I
> can correct your steps if you show them.
>
> Alex
>
> On Fri, 8 Aug 2025 at 22:55, Osama Abdelkader via
> lists.openembedded.org
> <osama.abdelkader=gmail.com@lists.openembedded.org> wrote:
> >
> > setting SDKMACHINE and MACHINE didn't work for me.
> > If it did work for you, can you type the exact command(s) to try?
> >
> > Osama
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#221668):
> https://lists.openembedded.org/g/openembedded-core/message/221668
> > Mute This Topic: https://lists.openembedded.org/mt/114603001/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
[-- Attachment #2: Type: text/html, Size: 3232 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OE-core] [PATCH] go-cross-canadian: fix binaries install and GOARCH
2025-08-11 22:22 ` Osama Ahmed
@ 2025-08-12 19:52 ` Alexander Kanavin
0 siblings, 0 replies; 6+ messages in thread
From: Alexander Kanavin @ 2025-08-12 19:52 UTC (permalink / raw)
To: Osama Ahmed; +Cc: openembedded-core
On Tue, 12 Aug 2025 at 00:22, Osama Ahmed <osama.abdelkader@gmail.com> wrote:
>
> If you set MACHINE to qemuriscv64 it will be go-cross-canadian-riscv64, the bugs were reported for arm/arm64 not riscv64
>
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=15204
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=15775
>
> Also, the majority of Yocto SDK users run on x86_64 workstations, so SDKMACHINE=x86_64 is the primary supported path
> and go-cross-canadian-aarch64 is supposed to work for any supported SDKMACHINE, as long as the host architecture is valid.
>
> Currently, if SDKMACHINE=x86_64 (the default for x86 PCs) building go-cross-canadian-aarch64 fails,
> with this patch build pass for both SDKMACHINE=x86_64 or aarch64.
The point I was trying to make is that this patch needs to work even
when all three architectures are different (e.g. the build host where
bitbake runs, the cross target (defined by MACHINE), and the sdk
target (defined by SDKMACHNE)). That was not obvious from just reading
the changes and the commit message..
Specifically, it wasn't clear from commit message why GOARCH =
"${HOST_GOARCH}" is necessary, and why it is correct. It is necessary
because GOARCH defaults to TARGET_GOARCH, which is set from MACHINE,
and it is correct because HOST_GOARCH is set from SDKMACHINE. I have
now found a bit of time to set up a build and run it, and the patch
seems to be doing the right thing, but its commit message should be
adjusted to include the above bit.
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-12 19:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 16:15 [PATCH] go-cross-canadian: fix binaries install and GOARCH Osama Abdelkader
2025-08-08 17:10 ` [OE-core] " Alexander Kanavin
2025-08-08 20:55 ` Osama Abdelkader
2025-08-11 8:47 ` [OE-core] " Alexander Kanavin
2025-08-11 22:22 ` Osama Ahmed
2025-08-12 19:52 ` Alexander Kanavin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox