I am using gentoo-sources 3.4.0. Genkernel fails to build busybox 1.20.1 for x32 ABI, saying ld: i386:x64-32 architecture of input file `applets/applets.o' is incompatible with i386:x86-64 output. However, if I emerge busybox with static and mdev USE flags, it builds and works fine. So I think this isn't an ordinary compilation failure of busybox, but has something to do with genkernel itself. Reproducible: Always Steps to Reproduce: genkernel all( or intramfs) Actual Results: compilation fails Expected Results: I should compile busybox as emerge does. I am sure the compiled kernel itself works-I can boot using the generated kernel, just busybox and thus initramfs fails to build. It doesn't matter much but is annoying.
Created attachment 315171 [details] genkernel log
Ditto here, exact same output.
This occurs because genkernel is forcibly overriding the default linker. * busybox: >> Compiling... COMMAND: make V=1 CC="gcc" LD="ld" AS="as" all ... gcc -Wp,-MD,applets/.applets.o.d -std=gnu99 -Iinclude -Ilibbb -include include/autoconf.h -D_GNU_SOURCE -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D"BB_VER=KBUILD_STR(1.20.1)" -DBB_BT=AUTOCONF_TIMESTAMP -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -Os -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(applets)" -D"KBUILD_MODNAME=KBUILD_STR(applets)" -c -o applets/applets.o applets/applets.c ld -r -o applets/built-in.o applets/applets.o ld: i386:x64-32 architecture of input file `applets/applets.o' is incompatible with i386:x86-64 output make[1]: *** [applets/built-in.o] Error 1 make: *** [applets_dir] Error 2 ld is trying to create 64-bit (x86_64) object code as output for applets/built-in.o, but applets/applets.o has been built as 32-bit (x32) code and those two don't match up. By default, busybox will use "$(CC) -nostdlib" as the default linker unless it's overridden (as you can see in the busybox Makefile). If you add '--utils-ld="x86_64-pc-linux-gnu-gcc -nostdlib"' to the genkernel command-line then busybox will build. This would seem to be a non-ideal workaround only, however.
i imagine if you update your CHOST to x86_64-pc-linux-gnux32, this starts working i also think this bug will bite anyone whose ABI=xxx setting does not match the default ABI that the linker produces. if genkernel pulled in ${LDFLAGS_${ABI}}, it could work. or the whole bug is semi-moot once busybox itself moves away from invoking the linker directly to the compiler driver ...
*** Bug 466840 has been marked as a duplicate of this bug. ***
In genkernel-4, cross-compile support was reworked. Could you please give it a try?