Bug 726495

Summary: glibc fails to build on ARM due to linking issues caused by -static-libgcc
Product: [Fedora] Fedora Reporter: Niels de Vos <ndevos>
Component: glibcAssignee: Jeff Law <law>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: aph, fweimer, jakub, schwab
Target Milestone: ---   
Target Release: ---   
Hardware: arm7   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-02 12:03:06 UTC Type: ---
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: 245418    
Attachments:
Description Flags
ugly hack for adding "-W,l:.../libc.a" when -static-libc is used none

Description Niels de Vos 2011-07-28 19:50:13 UTC
Description of problem:
Building the current rawhide (or any previous) glibc.src.rpm on ARM, fails. The linker can not find __stack_chk_guard (full error below).

Version-Release number of selected component (if applicable):
glibc-2.14.90-4

How reproducible:
100%

Steps to Reproduce:
1. fedpkg clone glibc
2. cd glibc
3. arm-koji build --scratch dist-f14 $(fedpkg giturl)
   (dist-f14 is currently the latest buildroot available)

Actual results:
A (temporary) scratch build can be found here:
- http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=137888

sotruss-lib.c:293:3: warning: #warning "pltenter for architecture not supported"
sotruss-lib.c:332:3: warning: #warning "pltexit for architecture not supported"
sotruss-lib.c:244:1: warning: 'print_enter' defined but not used
sotruss-lib.c:298:1: warning: 'print_exit' defined but not used
/usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/libgcc_eh.a(unwind-arm.o): In function `__gnu_Unwind_Backtrace':
(.text+0xf28): undefined reference to `__stack_chk_guard'
collect2: ld returned 1 exit status
make[2]: *** [/builddir/build/BUILD/glibc-2.14-121-g5551a7b/build-armv5tel-redhat-linuxeabi/elf/sotruss-lib.so] Error 1
make[2]: Leaving directory `/builddir/build/BUILD/glibc-2.14-121-g5551a7b/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/builddir/build/BUILD/glibc-2.14-121-g5551a7b'
make: *** [all] Error 2


Expected results:
Build succeeds.

Additional info:
sotruss-lib.so is the first .so that is linked, previous versions from glibc failed with similar errors, but on LibBrokenLocale.so.

Removing the -static-libgcc option from ./configure makes glibc compile successfully. The current Fedora ARM package is built with a patched .spec like:

sed -i 's/libc_cv_gcc_static_libgcc=-static-libgcc/libc_cv_gcc_static_libgcc=/' ./configure

This may well be a gcc issue, as -static-libgcc does not seem to work. Feel free to change the component accordingly.

Comment 1 Andrew Haley 2011-08-01 08:50:51 UTC
I suspect this is just another manifestation of the bug, now fixed, that causes gcj programs not to link,  I certainly had no such problem when I built libc yesterday.

Comment 2 Niels de Vos 2011-08-13 21:13:11 UTC
Created attachment 518160 [details]
ugly hack for adding "-W,l:.../libc.a" when -static-libc is used

Andrew mentioned in http://lists.fedoraproject.org/pipermail/arm/2011-August/001755.html that __stack_chk_guard should be defined in libc.a. This seems to be the case, but while building any .so, libc.a is not found automatically.

The attached patch adds libc.a to the linker search path when the -static-libgcc option is used (by sed'ing ./configure). This is surely not the right way, but I have not yet figured out how libc.a should be found otherwise.

Comment 3 Fedora Admin XMLRPC Client 2011-11-14 19:14:33 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora Admin XMLRPC Client 2011-11-15 04:46:38 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Niels de Vos 2012-02-02 12:03:06 UTC
It seems that glibc-2.14.1-2 was built successfully:
- http://arm.koji.fedoraproject.org/koji/buildinfo?buildID=35478

Same for glibc-2.15-4.fc17:
- http://arm.koji.fedoraproject.org/koji/buildinfo?buildID=48517

Closing this, please file a new bug in case the problem occurs with a newer Fedora release.