Try To Use The Minimal Library But Get - Segmentation Fault


nawa

Still Fresh
Joined
Jul 16, 2006
Messages
13
Hi all.
In an attempt to us the minimal library example, I got and "segmentation fault" error. I use the library to compile hello.c (an example of the library). It compile successfully but when I run it on my GP2x (under sterm) "segmentation fault error" (at just blank black screeen when run outside sterm). What would cause this and what should I do?

I have GP2X SDK installed and used it to complie the example. I did everything by the tutorial said (unless I miss anything).
1. I copy minimal.c and minimal.h to the same folder with hello.c
2. I compile it with "arm-gp2x-linux-gcc minimal.c hello.c -static -lpthread -lm -o hello.gpe". NOT that I use arm-gp2x-linux-gc instad of arm-linux-gcc because I don't find "arm-linux-gcc" anywhere in /gp2xsdk/
3. I copy the output file to GP2X and run.

I have some experiences writing direct access to hardware (VGA mode 13) before but more than 10 year ago and with Pascal (and inline ASM). I can read C and C++ but I really don't understand and don't like library linking the way C does. I think I may have miss anything about this library thing. I really want to get start writing something for GP2X and hope that I can contribute something. BUT first, I need to get some example running so I can beging to changing it and play with it. So any help would be very apprepriated.

Thanks in advance.
 
I believe I had the same problem, and it went away when I compiled without "-static".

Perhaps the dynamic version of the official SDK simply doesn't work with static linking (although I can't really think of a reason why).
 
I finally get thing going. I uninstall the official SDK and use devGP2X installer script instead and bang ... it works :D. Thanks for your answer anyway :D
 
Back
Top