Whenever I try to link some code with my ppc-amigaos-g++ cross compiler (compiled using adtools sources on SourceForge) I get lots of undefined references like these:
$ ppc-amigaos-g++ -use-dynld -O2 -Wall -Werror -o test test.cpp
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SjLj_Unregister'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SjLj_RaiseException'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SjLj_Resume_or_Rethrow'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_GetLanguageSpecificData'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SjLj_Resume'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_DeleteException'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_GetTextRelBase'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SetIP'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_GetDataRelBase'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_GetRegionStart'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SetGR'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_GetIPInfo'
/usr/local/amiga/lib/gcc/ppc-amigaos/4.2.4/../../../../ppc-amigaos/lib/libstdc++.so: undefined reference to `_Unwind_SjLj_Register'
collect2: ld returned 1 exit status
This happens even with an empty program like this:
int main (void) { return 0; }
FWIW I can get it link without the undefined references by adding the "-shared" option to the link command but then when I try to run the program in question it returns without ever reaching the main() function.
For now I've solved this by doing the linking step using native g++ but this is somewhat annoying.
@Fredrik
There was few topics where that issue was covered, few of them:
topic1
topic2
I solve those undef to _Unwinds just by adding -static, but that mean of course only static binary (but as far as i see from topics, they dicuss fixes as well)
I found the problem.
The problem is that the cross compiler libstdc++.so isn't linked against "libgcc.so" (or any other .so) for some reason. When I use the libstdc++.so from the native SDK that is linked with libgcc.so and libc.so with the cross compiler then everything works.
http://www.freelists.org/post/adtools/use-libgccso-instead-of-libgcc-sso,18