Reputation: 41
My host system is Linux debian 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64 GNU/Linux. I want to build a LFS and the glibc compilation stop me now. Here are the error prompts, thank you.
/mnt/lfs/sources/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `getanswer': /mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:180: undefined reference to `__stack_chk_guard' /mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:483: undefined reference to `__stack_chk_guard' /mnt/lfs/sources/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `res_gethostbyaddr': /mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:644: undefined reference to `__stack_chk_guard' /mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:783: undefined reference to `__stack_chk_guard' /mnt/lfs/sources/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `__GI_res_gethostbyname2': /mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:510: undefined reference to `__stack_chk_guard' /mnt/lfs/sources/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os):/mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:636: more undefined references to `__stack_chk_guard' follow collect2: error: ld returned 1 exit status make[2]: *** [/mnt/lfs/sources/glibc-build/resolv/libresolv.so] Error 1 make[2]: Leaving directory `/mnt/lfs/sources/glibc-2.17/resolv' make[1]: *** [resolv/others] Error 2 make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.17' make: *** [all] Error 2
Upvotes: 3
Views: 3309
Reputation: 31
I've found a solution to solve this problem:
Fixed by this sed in the gcc source before the first pass of gcc:
sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
and:
sed -i 's/if \((code.*))\)/if (\1 \&\& \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c
But these are already mentioned in the LFS-manual. I don't know why I didn't see them when I started with LFS :D
Upvotes: 3
Reputation: 11
Your gcc has stack protection enabled.
To get past this error:
CFLAGS="-fno-stack-protector -O2" ./configure --prefix=/somepath
on my system I ran:
mkdir build
cd build
CFLAGS="-fno-stack-protector -O2" ../configure --prefix=/usr/test_glibc
Upvotes: 1