Hello,
I might be able to help you.
First. A gcc source tar ball can be built as an arm cross compiler running on x86 host linux, but that exercise requires knowledge, patience and a calm mind....
IMO, the actual cross compiler is a piece of cake to build from gcc source. The problem starts with the userland libraries, which any 'hello world' app would make use of. For C, one would minimally need glibc and the C++ runtime if you're using C++.
My recommendation is; don't go this path ( unless you are interested in the topic or equipped with too much free time....)
Instead, give a big thank you to the boys over at codesourcery and download their 'lite' version for free. Browse to
http://www.codesourcery.com/sgpp/lite_edition.html, pick 'arm' and download the 'arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2' tar ball.
Now,
$ tar xjf arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
$ cd arm-2009q3/bin
$ export PATH=$PWD:$PATH
Now you've got the compiler in your path.
Check with
$ arm-none-linux-gnueabi-gcc -v
$ cd whereeveryoursourceis
$ arm-none-linux-gnueabi-gcc -o hello_world hello_world.c
With whatever means, maybe network exported drive or ftp, copy the 'hello_world' executable over to your plug and run it.
Result: guaranteed success.
A couple of points:
- It looked like the codesourcery people used a kernel source tree version 2.6.16 for the compliler. Myself, I am running Debian squeeze, which is a kernel 2.6.30. Does this matter?? Not really, unless you want to make use of some very new and fancy kernel interface, i.e. including and using something under /usr/include/linux/*.h. Your kernel might support this interface, but the compiler doesn't have it in its include file hierarchy. Well, you can copy over this one file into your application and it probably works anyway. But in general, the 16 to 30 diff doesn't matter for most apps.
- What about the glibc version?? Same thing here, codesourcery might be built with a slightly different version of glibc than actually installed on your plug. For most practical purposes; this doesn't matter. The most important thing is that the plug finds one compatible glibc shared lib. On your plug, you can check with
$ ldd hello_world
it will tell if it can load all dynamic dependencies.
- Someone else replied and talked about kernel dev. This doesn't really pertain to you since you are talking about user apps. But of course you can use code sourcery for building kernel too, there is a wiki and other postings describing this. NOTE: the kernel doesn't depend on ANY shared library provided by the compiler, therefore it is really much simpler to build a kernel or kernel modules since you never need to consider this...
Anyway, let me know if your are successful with the above approach.
PS. full source listing for 'hello_world.c' follows :-)
#include <stdio.h>
int
main( int argc, char *argv[] )
{
printf( "Hello everybody.\n" );
return 0;
}