I am trying to build a 32-bit windows toolchain by: "crossdev --target i686-w64-mingw32". Command fails at 'Emerging cross-gcc-stage2' step, with message: * error: gcc failed :( Reproducible: Always Steps to Reproduce: 1. launch command: crossdev --target i686-w64-mingw32 2. 3. Actual Results: compilation fails Expected Results: toolchain has to be built
Created attachment 757370 [details] cross-i686-w64-mingw32-info.log
Created attachment 757371 [details] cross-i686-w64-mingw32-gcc-stage2.log.xz
Created attachment 757372 [details] gcc-config.logs.tar.xz
I recommend you retry with more saner *FLAGS and disabling LTO stuff.
>--with-build-config=bootstrap-lto seems odd here. Is USE=lto enabled for it?
(In reply to Tee KOBAYASHI from comment #4) > I recommend you retry with more saner *FLAGS and disabling LTO stuff. Cross package constructs FLAGS by its own, according to log it uses: * CFLAGS="-O2 -pipe" * CXXFLAGS="-O2 -pipe" Did you mean these flags or some other? (In reply to Sam James from comment #5) > >--with-build-config=bootstrap-lto > seems odd here. Is USE=lto enabled for it? Yep, lto is enabled in USE, tried to re-run command w/ flag disabled, got same error: gcc failed :(
Ah, I forgot *FLAGS are not inherited from build host. They seem quite sane.
From i686-w64-mingw32/libstdc++-v3/config.log: configure:20794: checking for clock_gettime configure:20794: error: Link tests are not allowed after GCC_NO_EXECUTABLES. This is caused by: configure:4268: /var/tmp/portage/cross-i686-w64-mingw32/gcc-11.2.1_p20211127/work/build/./gcc/xgcc -B/var/tmp/portage/cross-i686-w64-mingw32/gcc-11.2.1_p20211127/work/build/./gcc/ -L/usr/i686-w64-mingw32/lib -L/usr/mingw/lib -isystem /usr/i686-w64-mingw32/include -isystem /usr/mingw/include -B/usr/i686-w64-mingw32/bin/ -B/usr/i686-w64-mingw32/lib/ -isystem /usr/i686-w64-mingw32/include -isystem /usr/i686-w64-mingw32/sys-include -o conftest -g -O2 conftest.c >&5 ../../../../../mingw64-runtime-9.0.0/work/mingw-w64-v9.0.0/mingw-w64-crt/crt/pseudo-reloc.c:50:13: warning: type of '_image_base__' does not match original declaration [-Wlto-type-mismatch] ../../../../../mingw64-runtime-9.0.0/work/mingw-w64-v9.0.0/mingw-w64-crt/crt/crtexe.c:43:25: note: type 'struct IMAGE_DOS_HEADER' should match type 'char' ../../../../../mingw64-runtime-9.0.0/work/mingw-w64-v9.0.0/mingw-w64-crt/crt/crtexe.c:43:25: note: '_image_base__' was previously declared here /usr/libexec/gcc/i686-w64-mingw32/ld: /var/tmp/portage/cross-i686-w64-mingw32/gcc-11.2.1_p20211127/temp/ccywWqcQ.ltrans0.ltrans.o:/var/tmp/portage/cross-i686-w64-mingw32/gcc-11.2.1_p20211127/work/build/i686-w64-mingw32/libstdc++-v3/../../../../../mingw64-runtime-9.0.0/work/mingw-w64-v9.0.0/mingw-w64-crt/stdio/mingw_pformat.c:556: undefined reference to `strnlen' /usr/libexec/gcc/i686-w64-mingw32/ld: /var/tmp/portage/cross-i686-w64-mingw32/gcc-11.2.1_p20211127/temp/ccywWqcQ.ltrans0.ltrans.o:/var/tmp/portage/cross-i686-w64-mingw32/gcc-11.2.1_p20211127/work/build/i686-w64-mingw32/libstdc++-v3/../../../../../mingw64-runtime-9.0.0/work/mingw-w64-v9.0.0/mingw-w64-crt/stdio/mingw_pformat.c:556: undefined reference to `strnlen' collect2: error: ld returned 1 exit status configure:4271: $? = 1 Maybe mingw64-runtime is built with LTO enabled? I suggest that you retry not only building gcc-stage2, but also mingw64-runtime, or preferably everything from start, with LTO disabled. I'm not sure where this LTO stuff came from, if the build host *FLAGS are not inherited to a cross environment.
(In reply to Tee KOBAYASHI from comment #8) > > I suggest that you retry not only building gcc-stage2, but also > mingw64-runtime, or preferably everything from start, with LTO disabled. > > I'm not sure where this LTO stuff came from, if the build host *FLAGS are > not inherited to a cross environment. Tried to unmerge runtime cross-i686-w64-mingw32/mingw64-runtime, disabled lto and re-run compilation -- got same error. Will forcibly rebuild all dependencies without lto, according to graph, and re-try.
Did you manage to solve this? I am running into this too.
(In reply to Kostadin Shishmanov from comment #10) > Did you manage to solve this? I am running into this too. Nope, just found that 32-bit env is not required for my tasks, so left at as is, since rebuilding of everything without lto doesn't help.
I managed to fix it by doing: crossdev --clean --target i686-w64-mingw32 crossdev --clean --target x86_64-w64-mingw32 Then, I removed every flag from my make.conf except for "-march=native -O2 -pipe" After that I tried building mingw again with crossdev --b 2.38 --target i686-w64-mingw32 crossdev --b 2.38 --target x86_64-w64-mingw32 and to my surprise it worked with no issues.