Bug 15775

Summary: go-cross-canadian: does not produce correct binaries for cross build
Product: [Build System, Metadata & Runtime] OE-Core Reporter: kweihmann
Component: devtools / tool chainAssignee: Osama Abdelkader <osama.abdelkader>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: Medium+ CC: alex.kanavin, meta.mr.watcher, meta.watcher, osama.abdelkader, randy.macleod, sundeep.kokkonda
Version: unspecified   
Target Milestone: 5.3 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description kweihmann 2025-02-27 09:04:33 UTC
Environment:

- plain poky
- target: qemuarm64
- host: x64_86 build machine

Reproduce:

- run bitbake go-cross-canadian-aarch64

Output:

Build Configuration:
BB_VERSION           = "2.9.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "qemuarm64"
DISTRO               = "poky"
DISTRO_VERSION       = "5.1"
TUNE_FEATURES        = "aarch64 crc cortexa57"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "master:2ae32dae580105156a151fa3dc7cbfe8673636e5"

Sstate summary: Wanted 72 Local 2 Mirrors 0 Missed 70 Current 248 (2% match, 78% complete)#################################################              | ETA:  0:00:00
Initialising tasks: 100% |###############################################################################################################################| Time: 0:00:00
NOTE: Executing Tasks
ERROR: go-cross-canadian-aarch64-1.22.12-r0 do_install: Execution of 
  '/path/to/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.22.12/temp/run.do_install.3322717' failed with exit code 1
ERROR: Logfile of failure stored in: /path/to/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.22.12/temp/log.do_install.3322717
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/path/to/layer/poky/meta/recipes-devtools/gcc/gcc-crosssdk_14.2.bb:do_populate_sysroot', 
    '/path/to/layer/poky/meta/recipes-devtools/go/go-binary-native_1.22.12.bb:do_populate_sysroot', 
    '/path/to/layer/poky/meta/recipes-devtools/go/go-crosssdk_1.22.12.bb:do_populate_sysroot', 
    '/path/to/layer/poky/meta/recipes-devtools/quilt/quilt-native_0.68.bb:do_populate_sysroot', 
    'virtual:native:/path/to/layer/poky/meta/recipes-devtools/chrpath/chrpath_0.18.bb:do_populate_sysroot', 
    'virtual:native:/path/to/layer/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', 
    'virtual:nativesdk:/path/to/layer/poky/meta/recipes-core/glibc/glibc_2.41.bb:do_populate_sysroot', 
    'virtual:nativesdk:/path/to/layer/poky/meta/recipes-devtools/gcc/gcc-runtime_14.2.bb:do_populate_sysroot', 
    'virtual:nativesdk:/path/to/layer/poky/meta/recipes-devtools/go/go-runtime_1.22.12.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['gettext-minimal-native', 
          'binutils-crosssdk-x86_64-pokysdk-linux', 'gcc-crosssdk-x86_64-pokysdk-linux', 'go-binary-native', 
          'go-crosssdk-x86_64-pokysdk-linux', 'libtool-native', 'm4-native', 'quilt-native', 'texinfo-dummy-native', 
          'gettext-native', 'zlib-native', 'chrpath-native', 'flex-native', 'gnu-config-native', 'pseudo-native', 
          'xz-native', 'zstd-native', 'attr-native', 'gmp-native', 'libmpc-native', 'mpfr-native', 'sqlite3-native', 
          'nativesdk-glibc', 'nativesdk-gcc-runtime', 'nativesdk-libgcc', 'nativesdk-go-runtime', 
          'nativesdk-linux-libc-headers']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_install
| install: omitting directory '/path/to/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.22.12/go/bin/linux_arm64'
| WARNING: exit code 1 from a shell command.
ERROR: Task (/path/to/layer/poky/meta/recipes-devtools/go/go-cross-canadian_1.22.12.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1121 tasks of which 973 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /path/to/layer/poky/meta/recipes-devtools/go/go-cross-canadian_1.22.12.bb:do_install
    log: /path/to/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.22.12/temp/log.do_install.3322717
Summary: There was 1 ERROR message, returning a non-zero exit code.

---

From the output it looks like `/go/bin/linux_arm64` is the wrong architecture.
Expected the host arch is x86_64.
PS: all the binaries in linux_arm64 are aarch64 as expected, so the passed down 
information into the build seems to be entirely mixed up in terms of host
and target arch.
PS: things ofc work with x86_64 target configuration, but it's just shadowing the issue

PS: tested revisions

a13c62b66b724e60cc6beae4ac88a5a9acc438e1 shows #15204
everything above:
891d30a5d435081b72790eba86a642ce5df0a353 shows error


Partly reverting https://git.yoctoproject.org/poky/commit/meta/recipes-devtools/go?id=34157b4b1aa40fbf2a70238a553e54f6bd157ace

from

- ./make.bash --target-only --no-banner
+ ./make.bash --host-only --no-banner

Solves the issue!
Comment 1 Randy MacLeod 2025-02-27 15:47:29 UTC
Alex, Any comments?
Comment 2 Alexander Kanavin 2025-02-27 16:13:49 UTC
I dont have any. Other than the usual 'patches welcome'.
Comment 3 Randy MacLeod 2025-05-01 14:09:07 UTC
Bulk move of most 5.2-M4 unassigned bugs to 5.3-M2.
Comment 4 Osama Abdelkader 2025-08-08 17:07:07 UTC
same patch of #15204 fix the problem:

https://patchwork.yoctoproject.org/project/oe-core/patch/20250808161533.13752-1-osama.abdelkader@gmail.com/
Comment 5 Randy MacLeod 2025-08-08 17:15:22 UTC
Seems to be a duplicate. Re-open if not.

*** This bug has been marked as a duplicate of bug 15204 ***