Message ID | 20250808161533.13752-1-osama.abdelkader@gmail.com |
---|---|
State | New |
Headers | show |
Series | go-cross-canadian: fix binaries install and GOARCH | expand |
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
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
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
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(-)