I'm trying to build a toolchain for s390x (s390x-ibm-linux-gnu) using crossdev, but it fails reproducible at building GCC stage 2: ------------------------------------------------------------------- * crossdev version: 20240921 * Host Portage ARCH: amd64 * Host Portage System: x86_64-pc-linux-gnu (x86_64-pc-linux-gnu) * Target Portage ARCH: s390 * Target System: s390x-ibm-linux-gnu * Stage: 4 (C/C++ compiler) * USE=multilib: no * Target ABIs: s390x * binutils: binutils-[latest] * gcc: gcc-[latest] * headers: linux-headers-[latest] * libc: glibc-[latest] * CROSSDEV_OVERLAY: /home/share/gentoo/var/db/repos/local * PORT_LOGDIR: /home/share/gentoo/var/log/portage * PORTAGE_CONFIGROOT: /home/share/gentoo/ * Portage flags: _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - * getting sys-devel/binutils from /home/share/gentoo/var/db/repos/local * leaving metadata/layout.conf alone in /home/share/gentoo/var/db/repos/local _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - * Log: /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-binutils.log * Emerging cross-binutils ... [ ok ] * Log: /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-gcc-stage1.log * Emerging cross-gcc-stage1 ... [ ok ] * Log: /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-linux-headers.log * Emerging cross-linux-headers ... [ ok ] * Log: /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-glibc.log * Emerging cross-glibc ... [ ok ] * Log: /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-gcc-stage2.log * Emerging cross-gcc-stage2 ... * error: gcc failed :( * * If you file a bug, please attach the following logfiles: * /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-info.log * /home/share/gentoo/var/log/portage/cross-s390x-ibm-linux-gnu-gcc-stage2.log.xz * /home/share/gentoo/var/tmp/portage/cross-s390x-ibm-linux-gnu/gcc*/temp/gcc-config.logs.tar.xz The actual build error is: /home/share/gentoo/var/tmp/portage/cross-s390x-ibm-linux-gnu/gcc-14.2.1_p20241026/work/build/./gcc/xgcc -B/home/share/gentoo/var/tmp/portage/cross-s390x-ibm-linux-gnu/gcc-14.2.1_p20241026/work/build/./gcc/ -B/home/share/gentoo/usr/s390x-ibm-linux-gnu/bin/ -B/home/share/gentoo/usr/s390x-ibm-linux-gnu/lib/ -isystem /home/share/gentoo/usr/s390x-ibm-linux-gnu/include -isystem /home/share/gentoo/usr/s390x-ibm-linux-gnu/sys-include -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -mlong-double-128 -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulhc3_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divhc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _mulbitint3_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o _divmodbitint4_s.o enable-execute-stack_s.o hardcfr_s.o strub_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so /home/share/gentoo/usr/libexec/gcc/s390x-ibm-linux-gnu/ld: /home/share/gentoo/usr/lib/../lib64/crti.o: Relocations in generic ELF (EM: 62) /home/share/gentoo/usr/libexec/gcc/s390x-ibm-linux-gnu/ld: /home/share/gentoo/usr/lib/../lib64/crti.o: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status No really sure what that tells me exactly, sorry. Is it trying to link object from different platforms (amd64 + s390x)? This used to work on the same system about half a year ago. Reproducible: Always
Created attachment 907565 [details] cross-s390x-ibm-linux-gnu-info.log
Created attachment 907566 [details] cross-s390x-ibm-linux-gnu-gcc-stage2.log.xz
Created attachment 907567 [details] gcc-config.logs.tar.xz
This looks odd and prefix specific somehow.
It works without prefix. I think this is an edge case I hadn't considered with my GCC ESYSROOT patch. The patch sets the sysroot based on ESYSROOT, but only for cross-compilers. In this case, a cross-compiler is being used, but ESYSROOT is set to the build host at /home/share/gentoo. Without prefix, ESYSROOT would be blank in this situation. I can't test it right now, but unsetting ESYSROOT during src_compile might fix it because gcc probably doesn't need additional help with the sysroot. I suspect we may need to do this for all the toolchain packages though, which isn't great. A more general solution would probably be to compare ESYSROOT with BROOT instead of merely checking whether it is non-empty.
(In reply to James Le Cuirot from comment #5) > I can't test it right now, but unsetting ESYSROOT during src_compile might > fix it because gcc probably doesn't need additional help with the sysroot. I > suspect we may need to do this for all the toolchain packages though, which > isn't great. Just to point this out, I can't test this either, because I don't know how. I know enough to make local changes to ebuild files, but I think this involves the toolchain class, and that is more than what I have experience with.
Okay, I'll get to it soon anyway. My desktop was just out of action for a while.