GP2X Linking Problems...


Ze_ro

Member
Joined
Nov 11, 2005
Messages
234
Location
Winnipeg, MB
Website
Visit site
I managed to get a toolchain (ooPo's toolchain) set up and working properly under Linux... but I'm having problems with things linking. One project I was working on porting (Abuse) was giving me messages about "_Unwind_SjLj_Register" being undefined. I tried forcing it to link with libgcc.a, and it worked fine. I'm now trying to compile a different program, and I'm getting this message:

aaa: relocation error: aaa: undefined symbol: _ZSt4cerr

I'd gladly just force it to link against whatever library has that in it, but I can't for the life of me figure out where it is. Is it just bad luck that I'm getting all these linking issues, or is there something I have set up wrong in my toolchain or something? I've compiled a number of other programs (mamegp2x for example) without any issues.

--Zero
 
Did you find out why this was happening? I'm actually running into the same problem:

./qonk.gpe: relocation error: ./qonk.gpe: undefined symbol: _ZSt4cerr

I read somewhere that this may have something to do with C usage in C++ programs, but I still don't know how to fix it.
 
Ok what that _ZSt4cerr means is that std::cerr is undefined, so any other standard function should screw up like this too, (cout, cin, etc.) I think it has something to do with two stdc++ libraries being used or something, I really don't know though.
 
Just add -static to your linking options, should solve all your problems.
 
I feel dumb, but I solved my problem, there was something up with my toolchain I was using. I had tried installing the open2x toolchain and somehow screwed up the library install. I still don't know what I did. Then I went to using the gp2xsdk and after a couple of minor errors and some code changes, immediate results. So, the lesson to be learned from this: If you get "cryptic" errors like this check your toolchain install first. THEN start looking around for what libraries you are linking your program with. This problem was caused by a libstdc++ library that was not equivalent to the one on the gp2x being linked to the program. I hope this helps others in this situation, and thanks Mudi for the input, your suggestion eventually led me to the real problem.
 
Just be warned... if you use the glibc/libstdc++ version on the gp2x, your program will not be compatible with the upcoming Open2X firmware without a recompile with the new glibc/libstdc++, unless you statically link with -static. There will probably be a compatibility mode for programs we can't get recompiled, but that's more of a pain than necessary :)

In any case, nearly all software currently out there for GP2X is statically linked already.
 
Back
Top