Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 942672 - sys-devel/crossdev: fails stage 2 under prefix with new gcc ESYSROOT patch
Summary: sys-devel/crossdev: fails stage 2 under prefix with new gcc ESYSROOT patch
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: James Le Cuirot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-01 16:57 UTC by Benjamin Block
Modified: 2024-11-11 16:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
cross-s390x-ibm-linux-gnu-info.log (cross-s390x-ibm-linux-gnu-info.log,20.63 KB, text/plain)
2024-11-01 16:58 UTC, Benjamin Block
Details
cross-s390x-ibm-linux-gnu-gcc-stage2.log.xz (cross-s390x-ibm-linux-gnu-gcc-stage2.log.xz,59.52 KB, application/octet-stream)
2024-11-01 16:58 UTC, Benjamin Block
Details
gcc-config.logs.tar.xz (gcc-config.logs.tar.xz,56.47 KB, application/octet-stream)
2024-11-01 16:58 UTC, Benjamin Block
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Block 2024-11-01 16:57:14 UTC
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
Comment 1 Benjamin Block 2024-11-01 16:58:09 UTC
Created attachment 907565 [details]
cross-s390x-ibm-linux-gnu-info.log
Comment 2 Benjamin Block 2024-11-01 16:58:28 UTC
Created attachment 907566 [details]
cross-s390x-ibm-linux-gnu-gcc-stage2.log.xz
Comment 3 Benjamin Block 2024-11-01 16:58:44 UTC
Created attachment 907567 [details]
gcc-config.logs.tar.xz
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-01 17:01:29 UTC
This looks odd and prefix specific somehow.
Comment 5 James Le Cuirot gentoo-dev 2024-11-02 15:23:42 UTC
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.
Comment 6 Benjamin Block 2024-11-11 14:43:13 UTC
(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.
Comment 7 James Le Cuirot gentoo-dev 2024-11-11 16:25:05 UTC
Okay, I'll get to it soon anyway. My desktop was just out of action for a while.