Red Hat Bugzilla – Bug 726495
glibc fails to build on ARM due to linking issues caused by -static-libgcc
Last modified: 2012-02-02 07:03:06 EST
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):
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)
A (temporary) scratch build can be found here:
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: *** [/builddir/build/BUILD/glibc-2.14-121-g5551a7b/build-armv5tel-redhat-linuxeabi/elf/sotruss-lib.so] Error 1
make: Leaving directory `/builddir/build/BUILD/glibc-2.14-121-g5551a7b/elf'
make: *** [elf/subdir_lib] Error 2
make: Leaving directory `/builddir/build/BUILD/glibc-2.14-121-g5551a7b'
make: *** [all] Error 2
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.
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.
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.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
It seems that glibc-2.14.1-2 was built successfully:
Same for glibc-2.15-4.fc17:
Closing this, please file a new bug in case the problem occurs with a newer Fedora release.