| Summary: | go-cross-canadian-arm fails to compile | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Tim <tim.vanderstaaij> | ||||
| Component: | devtools / tool chain | Assignee: | Osama Abdelkader <osama.abdelkader> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Medium | CC: | bart.staal, kweihmann, meta.mr.watcher, meta.watcher, osama.abdelkader, raj.khem, randy.macleod, richard.purdie, ross.burton, tgamblin | ||||
| Version: | 4.2.3 | ||||||
| Target Milestone: | 5.3 M3 | ||||||
| Hardware: | x86 | ||||||
| OS: | x86_64 | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |||||
| Attachments: |
|
||||||
Would you be able to reproduce this on a MACHINE from OE-Core? Those are the ones we test the release with. That's good to know. I ran a clean build of go-cross-canadian-arm with `MACHINE ??= "qemuarm"` and the issue does indeed reproduce. I confirm that this happens with pristine mickledore and qemuarm, and also happens for master. | go tool dist: FAILED: /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.7/go/pkg/tool/native_native/go_bootstrap install -ldflags=all=-linkmode external -extld x86_64-pokysdk-linux-gcc -extldflags "--sysroot=/yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.7/recipe-sysroot -no-pie -fno-PIE -march=x86-64 -Wl,-O1 -Wl,-rpath-link,/yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.7/recipe-sysroot/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/.. -Wl,-rpath,/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/.. " std cmd: exit status 1 Obviously we don't test a Go SDK... Copying Khem for any thoughts. Interestingly with master but targeting qemuarm64: $ bitbake go-cross-canadian-aaarch64 ... | # cmd/go | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/go/pkg/tool/native_native/link: running x86_64-pokysdk-linux-gcc failed: exit status 1 | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: Relocations in generic ELF (EM: 183) | /yocto/ross/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-aarch64/1.20.7/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/13.2.0/ld: /tmp/go-link-1900630836/go.o: error adding symbols: file in wrong format | collect2: error: ld returned 1 exit status | And for fun, mickledore for qemuarm64 builds but the binaries have buildpaths. Initially we (I'm a colleague of Tim) didn't find any error messages in the logs. It was only until I was adding some debug prints to the Go sourcecode until I noticed that the following message was already present in the logs: HASH[build runtime/cgo]: "import unsafe \n" HASH[build runtime/cgo]: e4c00e0cbacff15d748fb4865049cbaa607560ca144fc72071c8112260177214 # runtime/cgo gcc: error: unrecognized command-line option '-marm'; did you mean '-mabm'? Seems like the Go toolchain uses the right compiler (because it is building a compiler that runs on x86_64, to which SDKMACHINE is set), but somehow thinks it is building for arm? I checked the environment vars by invoking 'set' in do_compile() in go-cross-canadian.inc, just before make.bash is called. I found this in the output: GO386='' GOARCH='arm' GOARM='7' GODEBUG='gocachehash=1' GOHOSTARCH='amd64' GOHOSTOS='linux' GOMIPS='' GOOS='linux' I tried a build where I inserted the settings below in do_compile(). I copied the values from HOST_GOxxx variables I found by running 'bitbake -e': export GOARCH="amd64" export GOAOS="linux" export GOARM="" export GO386="sse2" This fixes the error message. I've not yet been able to check if the resulting toolchain also generates correct binaries (sorry, time was up). I also have no idea how to fix this correctly, probably it should be done somewhere in a .bbclass file? I tried to identify the commit that introduced this issue by running 'git checkout <commit> -- ../meta/recipes-devtools/go' in the kirkstone branch. It looks like commit 34157b4b 'go-cross-canadian: use gcc-crosssdk, not gcc-native' introduced this problem. Oh, and also I get warnings about 'references to TMPDIR'. Bulk move to 5.0 M1. -- Randy Bulk move of 52 5.0-M1 bugs to M2. Bulk move of bugs owned by "unassigned" from 5.0-M2 to 5.0-M3. I don't see any commits that fix this issue. Moving to M4. Bulk move to 5.2-M3. Bulk move to 5.2-M3 and this time I'll actually specify M3! I'm reviewing old milestones. Tim, can you check if this is still a problem one poky/master please? We'll review this bug on March 20th 10:30 AM ET. I tried to run `bitbake go-cross-canadian-arm` with poky master (e57dee3). Same minimum reproducible example as in my original report, except with MACHINE=qemuarm and updated LAYERSERIES_COMPAT. It still fails, but in a different way. Previously the issue was in do_compile. Now there is a problem with do_install: ERROR: go-cross-canadian-arm-1.24.1-r0 do_install: Execution of '<workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/temp/run.do_install.1109488' failed with exit code 1 ERROR: Logfile of failure stored in: <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/temp/log.do_install.1109488 Log data follows: | DEBUG: Executing python function extend_recipe_sysroot | NOTE: Direct dependencies are ['<workspace>/sources/poky/meta/recipes-devtools/gcc/gcc-crosssdk_14.2.bb:do_populate_sysroot', '<workspace>/sources/poky/meta/recipes-devtools/go/go-binary-native_1.24.1.bb:do_populate_sysroot', '<workspace>/sources/poky/meta/recipes-devtools/go/go-crosssdk_1.24.1.bb:do_populate_sysroot', '<workspace>/sources/poky/meta/recipes-devtools/quilt/quilt-native_0.68.bb:do_populate_sysroot', 'virtual:native:<workspace>/sources/poky/meta/recipes-devtools/chrpath/chrpath_0.18.bb:do_populate_sysroot', 'virtual:native:<workspace>/sources/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', 'virtual:nativesdk:<workspace>/sources/poky/meta/recipes-core/glibc/glibc_2.41.bb:do_populate_sysroot', 'virtual:nativesdk:<workspace>/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_14.2.bb:do_populate_sysroot', 'virtual:nativesdk:<workspace>/sources/poky/meta/recipes-devtools/go/go-runtime_1.24.1.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 '<workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/go/bin/linux_arm' | WARNING: <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/temp/run.do_install.1109488:166 exit 1 from 'install -m755 $f <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/go/bin' | WARNING: Backtrace (BB generated script): | #1: do_install, <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/temp/run.do_install.1109488, line 166 | #2: main, <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.24.1/temp/run.do_install.1109488, line 191 Bulk move of most 5.2-M4 unassigned bugs to 5.3-M2. Created attachment 5130 [details]
proposed fix
The do_install issue is that
for f in ${B}/${GO_BUILD_BINDIR}/*
line doesn't work for subdirectories, in the attached patch I fixed that by using 'find -type f'. I just sent the patch few minutes ago.
Thanks Osama! I applied the attached patch to master HEAD without issue. Can you send the patch to the email list? Is as easy as: $git send-email - -1 -M --to openembedded-core@lists.openembedded.org once you've set-up your account and email properly. https://docs.yoctoproject.org/contributor-guide/index.html Thanks Randy, I just sent it. *** Bug 15775 has been marked as a duplicate of this bug. *** Excellent, I see that patch on the list and that our patch bot hasn't complained! ;-) If you don't hear back on your email, check master on Monday or Tuesday and if merged, add a link here and resolve this issue. Welcome to Yocto! Thanks Randy. Thanks Osama! I can confirm the patch works for us. Fixed by: https://git.openembedded.org/openembedded-core/commit/?id=31e3bd61c7986bc044e547aa5cb9caba7b32bf22 Osama, Thanks for this fix and for the strace update which came in just in time to help with another problem! Thanks Bart. Thanks Randy, my pleasure :) |
In my project with a Cortex A7 target, the SDK fails to build after upgrading to Mickledore, because the image includes `go` in `SDK_TOOLCHAIN_LANGS` and go-cross-canadian-arm fails at the do_compile step. More specifically, in the step where the boostrap Go compiler is invoked to build the standard library and such, the compiler exits with status 1 without printing any output whatsoever. I can reproduce this failure with poky tags mickledore-4.2.0 and mickledore-4.2.3, as well as the mickledore branch tip and a recent master commit (40f215c). langdale-4.1.4 works fine however. Tested on Fedora 37 (native), Fedora 38 (native) and Debian Bullseye (containerized). Excerpts from output of `bitbake go-cross-canadian-arm`: | DEBUG: Executing shell function do_compile | Building Go cmd/dist using <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.6-r0/recipe-sysroot-native/usr/lib/go. (go1.20.6 linux/amd64) | go tool dist: FAILED: <workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.6-r0/go/pkg/tool/native_native/go_bootstrap install -ldflags=all=-linkmode external -extld x86_64-pokysdk-linux-gcc -extldflags "--sysroot=<workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.6-r0/recipe-sysroot -no-pie -fno-PIE -march=x86-64 -Wl,-O1 -Wl,-rpath-link,<workspace>/build/tmp/work/x86_64-nativesdk-pokysdk-linux/go-cross-canadian-arm/1.20.6-r0/recipe-sysroot/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/.. -Wl,-rpath,/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/.. " std cmd: exit status 1 | WARNING: exit code 2 from a shell command. NOTE: recipe go-cross-canadian-arm-1.20.6-r0: task do_compile: Failed Minimal reproducible example: sources/demo-bsp/conf/layer.conf --- BBPATH .= ":${LAYERDIR}" LAYERDEPENDS_meta-demo-bsp = "core" LAYERSERIES_COMPAT_meta-demo-bsp = "langdale mickledore" --- sources/demo-bsp/conf/machine/demo.conf --- require conf/machine/include/arm/armv7a/tune-cortexa7.inc --- build/conf/bblayers.conf --- POKY_BBLAYERS_CONF_VERSION = "2" BBPATH = "${TOPDIR}" BBFILES ?= "" YOCTOROOT = "${@os.path.abspath(os.path.join("${TOPDIR}", os.pardir))}" BBLAYERS ?= " \ ${YOCTOROOT}/sources/poky/meta \ ${YOCTOROOT}/sources/poky/meta-poky \ ${YOCTOROOT}/sources/demo-bsp \ " --- build/conf/local.conf as generated by `oe-init-build-env`, except for `MACHINE ??= "demo"`