Bug 1028849

Summary: ld: bogus undefined reference to `__stack_chk_fail'
Product: [Fedora] Fedora Reporter: Kevin Kofler <kevin>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 22CC: alexander, bugs+redhat, jakub, nickc, yselkowi
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 20:27:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 587568, 1106999    

Description Kevin Kofler 2013-11-11 03:43:50 UTC
Description of problem:
From the build.log:
http://kojipkgs.fedoraproject.org//work/tasks/7914/6157914/build.log
of kdebase3 in Rawhide:
http://koji.fedoraproject.org/koji/buildinfo?buildID=477304

/bin/sh ../libtool --silent  --tag=CXX   --mode=link g++  -DNDEBUG -DNO_DEBUG -O2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -D_GNU_SOURCE  -L/usr/lib/qt-3.3/lib  -Wl,--as-needed -Wl,--enable-new-dtags  -module -avoid-version -module -no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined   -Wl,-z,relro  -o konq_sound.la -rpath /usr/lib/kde3 konq_sound.lo -lsoundserver_idl -lartskde 
/usr/lib/libc_nonshared.a(stack_chk_fail_local.oS): In function `__stack_chk_fail_local':
(.text+0x10): undefined reference to `__stack_chk_fail'
collect2: error: ld returned 1 exit status
make[3]: *** [konq_sound.la] Error 1

Yet the __stack_chk_fail symbol should be in the libraries g++ links by default. An earlier kdebase3 build:
http://koji.fedoraproject.org/koji/buildinfo?buildID=462944
against older Rawhide packages succeeded, and all I changed was a .desktop file.

One of the packages that changed in the buildroot was binutils, so I guess that (in particular, GNU ld) is where the fault lies.

Version-Release number of selected component (if applicable):
binutils-2.24-4.fc21
(The earlier successful build had binutils-2.23.88.0.1-14.fc21.)

How reproducible:
Failed 2 times out of 2. (I didn't attempt to resubmit the job again after both the original and the resubmitted job failed the same way.)

Steps to Reproduce:
1. Try building kdebase3 in Rawhide.

Actual results:
The build fails with "undefined reference to `__stack_chk_fail'".

Expected results:
The build succeeds.

Additional info:
Strangely, kdebase3 appears to be the only package breaking that way in Rawhide, yet I haven't changed anything that could possibly have caused this in kdebase3 itself, so it must be one of the packages in the buildroot triggering the FTBFS.

Comment 1 Kevin Kofler 2013-11-11 03:46:59 UTC
To be clear, when I say "failed 2 times out of 2", I mean both builds failed, i.e. reproducing the bug succeeded. I assume it is always reproducible.

Comment 2 Kevin Kofler 2013-11-27 23:38:27 UTC
kdelibs3 fails with the same error:

Making all in bzip2
make[3]: Entering directory `/builddir/build/BUILD/kdelibs-3.5.10/kioslave/bzip2'
/bin/sh ../../libtool --silent  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../dcop -I../../kdecore -I../../kio/kssl -I../../kjs -I../../kio -I../../dcop -I../../libltdl -I../../kdefx -I../../kdecore -I../../kdecore -I../../kdecore/network -I../../kdeui -I../../kio -I../../kio/kio -I../../kio/kfile -I../.. -I/usr/lib/qt-3.3/include -I. -I/usr/include/kde   -DQT_THREAD_SUPPORT  -D_REENTRANT  -DNDEBUG -DNO_DEBUG -O2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fno-exceptions -fno-check-new -fno-common  -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -c -o kbzip2filter.lo kbzip2filter.cpp
/bin/sh ../../libtool --silent  --tag=CXX   --mode=link g++  -DNDEBUG -DNO_DEBUG -O2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fno-exceptions -fno-check-new -fno-common  -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -L/usr/lib/qt-3.3/lib  -Wl,--as-needed -Wl,--enable-new-dtags  -module -avoid-version -module -no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined   -Wl,-z,relro  -o kbzip2filter.la -rpath /usr/lib/kde3 kbzip2filter.lo ../../kio/libkio.la -lbz2 
/usr/lib/libc_nonshared.a(stack_chk_fail_local.oS): In function `__stack_chk_fail_local':
(.text+0x10): undefined reference to `__stack_chk_fail'
collect2: error: ld returned 1 exit status
make[3]: Leaving directory `/builddir/build/BUILD/kdelibs-3.5.10/kioslave/bzip2'
make[3]: *** [kbzip2filter.la] Error 1

Comment 3 Kevin Kofler 2013-12-01 14:08:02 UTC
Configuring with --disable-new-ldflags instead of --enable-new-ldflags works around this, so it looks like it is a bug in ld related to -Wl,--as-needed or one of the other -Wl flags.

Comment 4 Yaakov Selkowitz 2014-06-12 21:25:30 UTC
Also affects kdegames3 in bug 1106999.

Comment 5 Jaroslav Reznik 2015-03-03 15:12:01 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 6 Fedora End Of Life 2016-07-19 20:27:36 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.