Problems linking with g++ cross compiler created from adtools

3 posts / 0 new
Last post
salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
Problems linking with g++ cross compiler created from adtools

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:

  1. int main (void) {
  2. return 0;
  3. }

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.

kas1e
kas1e's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2010-11-30 15:30
@Fredrik There was few topics

@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)

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
I found the problem. The

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

Log in or register to post comments