Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 827923

Summary: cross-{i686,x86_64}-w64-mingw32/gcc-10.3.0-r2: undefined reference to `__stack_chk_guard'
Product: Gentoo Linux Reporter: James Beddek <telans>
Component: Current packagesAssignee: Gentoo Crossdev team <crossdev>
Status: RESOLVED INVALID    
Severity: normal CC: zorry
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=513706
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: cross-x86_64-w64-mingw32-info.log
cross-x86_64-w64-mingw32-gcc-stage2.log.xz
gcc-config.logs.tar.xz

Description James Beddek 2021-12-01 00:32:40 UTC
Created attachment 757109 [details]
cross-x86_64-w64-mingw32-info.log

I'm encountering the same build failure as seen in https://bugs.gentoo.org/513706 from 2014. Though I'm opening a new issue as I'm sure there have been a lot of changes in the 7 years since, and apparently this bug was "Fixed in CVS" (@zorry). I'm not sure what change it was that had meant to fix it.

/usr/libexec/gcc/x86_64-w64-mingw32/ld: /usr/x86_64-w64-mingw32/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x202): undefined reference to `__stack_chk_fail'
/usr/libexec/gcc/x86_64-w64-mingw32/ld: /usr/x86_64-w64-mingw32/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x4e2): undefined reference to `__stack_chk_fail'
/usr/libexec/gcc/x86_64-w64-mingw32/ld: /usr/x86_64-w64-mingw32/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]+0x0): undefined reference to `__stack_chk_guard'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:994: libgcc_s.dll] Error 1

Cheers
Comment 1 James Beddek 2021-12-01 00:33:29 UTC
Created attachment 757110 [details]
cross-x86_64-w64-mingw32-gcc-stage2.log.xz
Comment 2 James Beddek 2021-12-01 00:34:12 UTC
Created attachment 757111 [details]
gcc-config.logs.tar.xz
Comment 3 James Beddek 2021-12-01 00:35:50 UTC
Note: I'm using the default USE flags for the cross compiler installation through crossdev
Comment 4 Tee KOBAYASHI 2021-12-01 01:09:19 UTC
I see "-fstack-protector-strong -D_FORTIFY_SOURCE=2" in your CFLAGS. It would be troublesome if cross-x86_64-w64-mingw32_ucrt/mingw64-runtime were built with these flags.
Comment 5 James Beddek 2021-12-01 01:26:28 UTC
Ah that's a duh on my part as I use the Clang compiler on my system, and Clang doesn't have sane semi-hardening defaults. https://wiki.gentoo.org/wiki/Clang#Clang_environments

Now crossdev works a treat after switching mingw64-runtime to use a gcc env. Thanks for helping me fix this :)