Hello guys, Am having a problem linking against libstdc++. Linking against libstdc++ generates the following errors;
anchor:/anchor-toolchain/onward/packages/phase-two/gcc$ gcc t.c -lstdc++ /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libssp.so: warning: the 'gets' function is dangerous and should not be used. /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_Resume_or_Rethrow' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_RaiseException' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetLanguageSpecificData' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_Resume' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_DeleteException' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetTextRelBase' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_SetIP' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetDataRelBase' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetRegionStart' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_SetGR' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetIPInfo' collect2: ld returned 1 exit status --t.c------------------------------ #include <stdio.h> int main() { printf("test\n"); return 0; } ------------------------------------- The _Unwind* functions are defined in libgcc_s. When I link against libgcc_s, i get the following error; $ gcc t.c -lstdc++ -lgcc_s $ ./a.out Can't modify /anchor-tools/lib/libstdc++.so.6's text section. Use GCC option -fPIC for shared objects, please. Can someone please tell me the cause of the above error and how to get rid of it. NB: am using gcc 4.2.4 and uClibc-0.9.30.1 Attached is the verbose out from running 'gcc -v t.c -Wl,--verbose'
/anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libssp.so: warning: the 'gets' function is dangerous and should not be used. /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_Resume_or_Rethrow' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_RaiseException' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetLanguageSpecificData' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_Resume' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_DeleteException' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetTextRelBase' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_SetIP' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetDataRelBase' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetRegionStart' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_SetGR' /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libstdc++.so: undefined reference to `_Unwind_GetIPInfo' collect2: ld returned 1 exit status
-- http://linuxfromscratch.org/mailman/listinfo/hlfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page