http://www.hackint0sh.org/forum/f9/65583.htm

You can use iphone open toolchain 2.0. Although you may spend some time to get it running(well I did).

Ok, basically the idea behind it is that you can prepare the toolchain to compile your programs natively on the iphone itself. Of course you don't have to use the iphone-terminal to do it SSH-session is quite handy to do all the stuff.

Well it may sound easy but doing it from scratch actually was quite time consuming and annoying.

The hard way:
1. Download iPhone OS 2.0 SDK , file is called iphone_sdk_final.dmg [about 1.3 GB]
2. Download 7-Zip 4.59 Beta or latest one.
3. Run 7-Zip and open the downloaded dmg file.
4. Go to Packages and extract iPhoneSDKHeadersAndLibs.pkg
5. Open the pkg file in 7-Zip and extract Payload
6. Download Cygwin installer.
7. Install and leave all options to default beside including gcc and make in devel section.
8. Make sure cygwin is running and gcc and make are available.
9. Download latest sources of cpio [if you are not familiar with unix tools:tar -xvf filename.tar.gz to decompress it ].
10. Compile it and install it under cygwin (readme files are provided how to do it).
11. In cygwin:If your cpio is working move the extracted Payload file to some dir and make it your current one.
12. Now comes a series of commands ,just keep typing them:
zcat Payload | cpio -id '*.h'

mkdir include

mv Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/* .
rmdir -p Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/

mv System/Library/Frameworks/* .
rmdir -p System/Library/Frameworks/

mv AddressBook.framework/Headers include/AddressBook
mv AddressBookUI.framework/Headers include/AddressBookUI
mv AudioToolbox.framework/Headers include/AudioToolbox
mv AudioUnit.framework/Headers include/AudioUnit
mv CFNetwork.framework/Headers include/CFNetwork
mv CoreAudio.framework/Headers include/CoreAudio
mv CoreFoundation.framework/Headers include/CoreFoundation
mv CoreGraphics.framework/Headers include/CoreGraphics
mv CoreLocation.framework/Headers include/CoreLocation
mv Foundation.framework/Headers include/Foundation
mv MediaPlayer.framework/Headers include/MediaPlayer
mv OpenAL.framework/Headers include/OpenAL
mv OpenGLES.framework/Headers include/OpenGLES
mv QuartzCore.framework/Headers include/QuartzCore
mv Security.framework/Headers include/Security
mv SystemConfiguration.framework/Headers include/SystemConfiguration
mv UIKit.framework/Headers include/UIKit
rmdir -p *.framework

mv usr/include/* include/
rm -rf usr/lib
rmdir -p usr/include/

rm Payload
tar --group 0 --owner 0 -cvf include.tar include

13. The end of the hard way: you get your beloved include.tar

The easy way:
Contact me via private message and I'll provide you with include.tar. However I'm not allowed to distribute it publicly due to Apple SDK licence.

Iphone stuff:
1. Copy the include.tar to /private/var/root [well actually any directory will do]
2. Now type:
cd /var
tar xf /private/var/root/include.tar

3. For iphone firmware 2.2(and 2.2.1 i presume) you also need to type:
cd /var/include
ls stdint.h
make sure it doesn't exist, if so
ln -s gcc/darwin/4.0/stdint.h stdint.h

You now should have the headers for your iphone on your iphone
4. Run Cydia and install : GNU C Compiler , Make from Development section. You will also need Link Identity Editor(ldid) for signing your apps [though there are other methods to bypass sign-checking I won't discuss it].
5. Download a helloWorld example i.e:http://antirez.com/misc/iphone-helloworld-1.tar.gz
6. Extract , enter directory , type make
7. Copy the created *.app directory to /Applications
8. Type /Applications/BossPrefs.app/Respring and enjoy your first helloWorld application[of course you need BossPrefs installed].

95% of this instructions are based on Toolchain 2.0 - The iPhone Wiki and Developing for the iphone using the open toolchain and SDK 2.0 headers - antirez weblog so the credit goes to original authors. This is just dumb implementation of instructions I found there.

Hope sb finds it helpful.

Posted by redcroix
,