Saturday, June 28, 2008

[How-To] Install gcc compiler in iPhone (1.1.x firmware)

Cydia is a new package management replacement to the existing And it now also brings the gcc compiler to iPhone in firmware 1.1.x

Although it is slow to compile in iPhone but it is stable and very native.

You can follow these steps to install the compiler and related headers and utilities:

1. Set your iPhone Auto-Lock to "Never"
2. Goto Installer and install the package called "Cydia Installer" (version 1.0). It will take some time to download and install, so you should have connected your iPhone to Wifi
3. After installation of Cydia, iPhone will reboot and you will find a new icon "Cydia" in your Home Screen. Start "Cydia" and it will tell you to update Critical Packages. Follow the instructions to "Update All"
4. After update of Critical Packages in Cydia, install the following 3 packages

GNU C Compiler
iPhone 1.1.1 Headers

5. Then you can have gcc compiler in your iPhone now. You can use Mac Terminal or putty to access the terminal of iPhone and start building your application.

Please take note that after the installation of Cydia, your BSD subsystem is now changed to Fake BSD subsystem and also fixed a number of bugs. So don't update BSD subsystem from the

You may want to try some HelloWorld example, and here is the project that you can try

copy and unzip it to your iPhone

cd HelloWorld
make install

Then you will have a new program HelloWorld.

To uninstall this HelloWorld

make uninstall



Unknown said...

I would try to play something with my beautiful friend ipod touch.
I installed gcc and toolchain and i start with your example helloworld appl.
Thru putty i try to compile the example but an error occur:
(here the log:)
baguTpod:/Developer/HelloWorld root# make install
arm-apple-darwin-gcc -c -I"/usr/local/arm-apple-darwin/include" -DDEBUG -O3 -Wall -std=c99 -funroll-loops Classes/main.m -o Classes/main.o
Classes/main.m: In function 'main':
Classes/main.m:12: warning: passing argument 3 of 'UIApplicationMain' from distinct Objective-C type
Classes/main.m:12: error: too few arguments to function 'UIApplicationMain'
make: *** [Classes/main.o] Error 1
baguTpod:/Developer/HelloWorld root#

What's the problem? And iff possible, what's the solutions?
Thanks for your work and in advice for solutions :)


javacom said...

The project file was for 1.1.x. If you use it for firmware 2.0.x, you have to change UIApplicationMain to
returnCode = UIApplicationMain(argc, argv, @"HelloWorldApp", @"HelloWorldApp");

and you have to fake codesign the binary as well. Otherwise it will be killed by the OS

Elton Shannon said...

you will have the iPhone gcc compiler in your iPhone/iPod now. You can use Mac Terminal or Windows putty to access the terminal of iPhone/iPod via SSH and start building your application.

Eric Colon said...

you will have the iPhone gcc compiler in your iPhone/iPod now. You can use Mac International airport or Windows putty to accessibility the terminal of iPhone/iPod via SSH and begin to build your program.