Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 828116 - crossdev --target i686-w64-mingw32 fails to compile
Summary: crossdev --target i686-w64-mingw32 fails to compile
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Cross compilation support
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-04 06:13 UTC by Paul Bordukov
Modified: 2022-04-25 22:51 UTC (History)
2 users (show)

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


Attachments
cross-i686-w64-mingw32-info.log (cross-i686-w64-mingw32-info.log,19.78 KB, text/plain)
2021-12-04 06:14 UTC, Paul Bordukov
Details
cross-i686-w64-mingw32-gcc-stage2.log.xz (cross-i686-w64-mingw32-gcc-stage2.log.xz,67.45 KB, application/octet-stream)
2021-12-04 06:15 UTC, Paul Bordukov
Details
gcc-config.logs.tar.xz (gcc-config.logs.tar.xz,72.32 KB, application/octet-stream)
2021-12-04 06:17 UTC, Paul Bordukov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Bordukov 2021-12-04 06:13:47 UTC
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
Comment 1 Paul Bordukov 2021-12-04 06:14:58 UTC
Created attachment 757370 [details]
cross-i686-w64-mingw32-info.log
Comment 2 Paul Bordukov 2021-12-04 06:15:41 UTC
Created attachment 757371 [details]
cross-i686-w64-mingw32-gcc-stage2.log.xz
Comment 3 Paul Bordukov 2021-12-04 06:17:57 UTC
Created attachment 757372 [details]
gcc-config.logs.tar.xz
Comment 4 Tee KOBAYASHI 2021-12-04 06:36:24 UTC
I recommend you retry with more saner *FLAGS and disabling LTO stuff.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-05 01:09:05 UTC
>--with-build-config=bootstrap-lto 
seems odd here. Is USE=lto enabled for it?
Comment 6 Paul Bordukov 2021-12-05 05:42:22 UTC
(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 :(
Comment 7 Tee KOBAYASHI 2021-12-05 08:21:42 UTC
Ah, I forgot *FLAGS are not inherited from build host. They seem quite sane.
Comment 8 Tee KOBAYASHI 2021-12-06 02:09:41 UTC
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.
Comment 9 Paul Bordukov 2021-12-06 16:55:46 UTC
(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.
Comment 10 Kostadin Shishmanov 2022-04-23 10:09:44 UTC
Did you manage to solve this? I am running into this too.
Comment 11 Paul Bordukov 2022-04-24 07:15:45 UTC
(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.
Comment 12 Kostadin Shishmanov 2022-04-25 22:51:39 UTC
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.