Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 516354 - cross-i686-pc-mingw32/gcc-4.8.3 - .../work/gcc-4.8.3/libquadmath/printf/mul.c:58: undefined reference to `__stack_chk_guard'
Summary: cross-i686-pc-mingw32/gcc-4.8.3 - .../work/gcc-4.8.3/libquadmath/printf/mul.c...
Status: RESOLVED DUPLICATE of bug 513706
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-04 11:35 UTC by Alibek
Modified: 2014-07-30 08:54 UTC (History)
2 users (show)

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


Attachments
cross-i686-pc-mingw32-info.log (cross-i686-pc-mingw32-info.log,16.14 KB, text/plain)
2014-07-04 11:36 UTC, Alibek
Details
cross-i686-pc-mingw32-gcc-stage2.log.xz (cross-i686-pc-mingw32-gcc-stage2.log.xz,55.95 KB, application/x-xz)
2014-07-04 11:37 UTC, Alibek
Details
gcc-config.logs.tar.xz (gcc-config.logs.tar.xz,62.37 KB, application/x-xz)
2014-07-04 11:37 UTC, Alibek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alibek 2014-07-04 11:35:38 UTC
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 :(
Comment 1 Alibek 2014-07-04 11:36:29 UTC
Created attachment 380170 [details]
cross-i686-pc-mingw32-info.log
Comment 2 Alibek 2014-07-04 11:37:02 UTC
Created attachment 380172 [details]
cross-i686-pc-mingw32-gcc-stage2.log.xz
Comment 3 Alibek 2014-07-04 11:37:54 UTC
Created attachment 380174 [details]
gcc-config.logs.tar.xz
Comment 4 Alibek 2014-07-04 12:59:59 UTC
It seems compiling, if enable "libssp" USE-flag.
Comment 5 Alibek 2014-07-04 13:02:31 UTC
No, it's not compiling. =(

Same errors.
Comment 6 Andrew Udvare 2014-07-09 10:42:40 UTC
Same error here. Unfortunately this pops up in emerge -auvDN @world now for me because of changed USE flags.
Comment 7 Andrew Udvare 2014-07-09 10:54:05 UTC
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
Comment 8 Gabriel Marcano 2014-07-13 04:03:44 UTC
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?
Comment 9 SpanKY gentoo-dev 2014-07-30 08:54:28 UTC

*** This bug has been marked as a duplicate of bug 513706 ***