Installing GCC On iPhone/iPod Touch
After hearing that GCC had been ported over to the iPod Touch/iPhone, I was intrigued. GCC has always been my favourite compiler, and I think its pretty neat to have it installed on your iPhone/iPod Touch. I just finished setting it up on my touch and I will admit, its pretty cool. There’s not a whole lot of information about this on the web, it looks like there only a handful of people interested in this. Its not the most practical thing, but it is still nice to have. I guess if you wanted to get serious, you would simply cross compile all of your code. I will also mention that it has MAJOR issues. Unfortunately it does not even include the standard iostream file, for c++ programming. Pretty useless, but that can be simply installed later. For those of you who want to install GCC, it can be installed through Cydia. Make sure you have your settings set to “developer”, or you will not be able to find it in Cydia, the package name is “GNU C Compiler”. Once you search it (it can be found under “Development”) you will find that it cannot be installed. It depends on “libgcc” which cannot be found in Cydia. My understanding is that since the package is not incomplete and buggy, libgcc has been removed to discourage you from installing it. In order to install all the prerequisites for GCC, libgcc must be installed. Fortunately, a libgcc deb package has been created for this very propose! It is called “fake libgcc”. I thought I would have difficulty finding a libgcc deb file that has been ported to the iPhone, but I did (Google is the best!). Just do a quick search. After you have the file, simply SSH into your device. Upload the deb file to the root directory and run dpkg. Still in the root directory, run dkpg -i fake-libgcc_1.0_iphoneos-arm.deb (or whatever your particular libgcc file name happens to be). That’s it. You can now install GCC right through Cydia. Like I said before, the package does not include the standard iostream library. I am trying to figure that out, as you can’t program in C++ without it, obviously. I have not tried compiling a C program yet, but I doubt stdio.h is included either. If it does I don’t imagine it works. Like I said before, it appears to be VERY buggy. It doubt installing the headers will be very difficult, I imagine you simply download the header and SSH it to the appropriate location. Although, I’m not quite sure where that location might be… Hopefully I can get the iostream headers to work, because I think this is pretty neat!