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

Bug 621178

Summary: sys-devel/gcc-5.4.0-r3 fails to build - libgomp/task.c:115:1: error: stack protector not protecting local variables: variable length buffer [-Werror=stack-protector]
Product: Gentoo Linux Reporter: Zhu Sha Zang <zhushazang>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Severity: normal CC: esigra, jstein, kensington, leio, slyfox
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 260867    
Attachments: Build Log
Gcc build log asked by emerge
pqv return

Description Zhu Sha Zang 2017-06-08 01:57:01 UTC
Every time that I try to compile gcc 5.4.0 version the process fail with the same error. 

Using "revdep-rebuild --library '' -- --exclude gcc" wont solved the problem.

Best regards
Comment 1 Zhu Sha Zang 2017-06-08 01:58:11 UTC
Created attachment 475576 [details]
Build Log
Comment 2 Zhu Sha Zang 2017-06-08 01:58:35 UTC
Created attachment 475578 [details]
Comment 3 Zhu Sha Zang 2017-06-08 01:59:04 UTC
Created attachment 475580 [details]
Gcc build log asked by emerge
Comment 4 Zhu Sha Zang 2017-06-08 01:59:28 UTC
Created attachment 475582 [details]
Comment 5 Zhu Sha Zang 2017-06-08 01:59:47 UTC
Created attachment 475584 [details]
pqv return
Comment 6 Michael Palimaka (kensington) gentoo-dev 2017-06-10 04:37:27 UTC
Does it work if you remove -Wstack-protector from CFLAGS?
Comment 7 Zhu Sha Zang 2017-06-11 23:59:07 UTC
Yeah, worked. I was able to compile til the end. But why. If you don't mind, can you explain what happened here?

Best regards.
Comment 8 Michael Palimaka (kensington) gentoo-dev 2017-06-13 11:13:42 UTC
Looking at the last error in the log:
checking for inttypes.h... /var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp/task.c: In function ‘GOMP_task’:
/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp/task.c:115:1: error: stack protector not protecting local variables: variable length buffer [-Werror=stack-protector]
 GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),

Then a few lines later:
checking for stdint.h... libtool: compile:  /var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/build/./gcc/xgcc -B/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-l
inux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp -I/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp/config/linux/x86 -I/var/tmp/notmpfs/portag
e/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp/config/linux -I/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp/config/posix -I/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp -I/var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/w
ork/gcc-5.4.0/libgomp/../include -Wall -Werror -pthread -ftls-model=initial-exec -g -march=core2 -mtune=generic -O2 -pipe -Wstack-protector -MT work.lo -MD -MP -MF .deps/work.Tpo -c /var/tmp/notmpfs/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/libgomp/work.c -o work.o >
/dev/null 2>&1
checking for unistd.h... cc1: all warnings being treated as errors

So, the combination of -Wstack-protector in your CFLAGS (enabling stack-protector warnings) and -Werror from the build system (treat all warnings as fatal errors) causes the build failure.

Marking as a blocker of bug #260867, as we don't normally permit -Werror in our build systems.
Comment 9 Andreas K. Hüttel archtester gentoo-dev 2017-10-03 19:03:50 UTC

*** This bug has been marked as a duplicate of bug 618426 ***
Comment 10 Mart Raudsepp gentoo-dev 2017-12-15 09:00:18 UTC
Re-opening for reconsideration in light of

I guess this is an edge case from additional warnings being added by user CFLAGS.
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-27 16:32:21 UTC
I broke it in bug #581406 and I'll fix it.
Comment 12 Larry the Git Cow gentoo-dev 2018-10-27 19:22:01 UTC
The bug has been closed via the following commit(s):

commit c84f250076a6a6f33202c022a256b34284d91111
Author:     Sergei Trofimovich <>
AuthorDate: 2018-10-27 19:17:52 +0000
Commit:     Sergei Trofimovich <>
CommitDate: 2018-10-27 19:21:54 +0000

    sys-devel/gcc: cut 1.11 patchset for 5.4.0
    Eight new patches:
    + 99_all_remove-lieee.patch:
      drop assumed -lieee from -mieee-fp
    + 100_all_libgfortran-Werror.patch:
    + 101_all_libgomp-Werror.patch
    + 102_all_libitm-Werror.patch
    + 103_all_libatomic-Werror.patch
    + 104_all_libbacktrace-Werror.patch
    + 105_all_libsanitizer-libbacktrace-Werror.patch:
      pull in all -Werror patches from 8.2.0
    + 106_all_libstdcxx-no-vtv.patch:
      drop libvtv RPATH from libstdc++
    Signed-off-by: Sergei Trofimovich <>
    Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-devel/gcc/Manifest            |  1 +
 sys-devel/gcc/gcc-5.4.0-r6.ebuild | 44 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)