GCC stage2 fails on i686-mingw32. undefined reference to `__stack_chk_fail' when compiling libstdc++. Reproducible: Always Steps to Reproduce: 1. crossdev -t i686-pc-mingw32 2. Wait. 3. gcc failed :(
Created attachment 380170 [details] cross-i686-pc-mingw32-info.log
Created attachment 380172 [details] cross-i686-pc-mingw32-gcc-stage2.log.xz
Created attachment 380174 [details] gcc-config.logs.tar.xz
It seems compiling, if enable "libssp" USE-flag.
No, it's not compiling. =( Same errors.
Same error here. Unfortunately this pops up in emerge -auvDN @world now for me because of changed USE flags.
Sorry, what I meant to stay was that stage 4 cannot be built so as a result: cross-i686-pc-mingw32/gcc-4.8.3 was built with the following: USE="nls nptl (policykit) (-altivec) -awt -cxx -doc (-fixed-point) -fortran -gcj -go -graphite -hardened -libssp -mudflap -multilib -multislot -nopie -nossp -objc -objc++ -objc-gc -openmp -regression-test -vanilla" ABI_X86="64" CFLAGS="-O2 -pipe" CXXFLAGS="" Meaning no stage 2 or above has been installed. To fix for now, so it doesn't appear in @world updates, add to /etc/portage/package.use/cross-i686-pc-mingw32 # Stage 2 and onward cannot be built yet with >=4.8.3 # https://bugs.gentoo.org/show_bug.cgi?id=516354 cross-i686-pc-mingw32/gcc -cxx -fortran -openmp
This problem also affects cross-x86_64-w64-mingw32/gcc-4.8.3. In fact, the error messages found in the cross-i686-pc-mingw32-gcc-stage2.log.xz attachment are identical (this is only the first one): /var/tmp/portage/cross-x86_64-w64-mingw32/gcc-4.8.3/work/gcc-4.8.3/libquadmath /printf/mul.c:58: undefined reference to `__stack_chk_guard' I did some digging around... This specific error is related to the stack-protector settings now turned on by default in gcc-4.8.3 and above (according to the portage news "GCC 4.8.3 defaults to -fstack-protector"). While digging around in the toolkit.eclass, I noticed an interesting piece of code: gcc_do_filter_flags() { ... if is_crosscompile ; then # Set this to something sane for both native and target CFLAGS="-O2 -pipe" FFLAGS=${CFLAGS} FCFLAGS=${CFLAGS} local VAR="CFLAGS_"${CTARGET//-/_} CXXFLAGS="${!VAR}" fi ... } These seem to be the flags used for stage2 compilation. Of notice, these completely ignore anything the user has set (I understand why in general-- it's difficult to determine what flags are safe across architectures for GCC, from what I gather). One side-effect of this is that it's a pain to pass custom flags to GCC stage2 compilations for cross-compilers. For testing purposes, I added -fno-stack-protector to both CFLAGS and CXXFLAGS in the toolchain.eclass, and lo and behold, the mingw gcc cross-compiler compiled. The bug seems to be related to stack protection. Now that I understand the problem a little better, I did some more searching in this Bugzilla and found bug 513706, which seems to be the general case bug describing this problem (meaning this bug report may be a duplicate of that one). Could anyone else confirm this?
*** This bug has been marked as a duplicate of bug 513706 ***