http://eagos.net/tutorial-installing-gcc-compiler-on-iphone/comment-page-1/#comment-31
This Tutorial needs headers and libraries from Mac OSX.
-
Make sure the following applications are installed from Cydia.
- Mobile Terminal
- Safari Download Plugin
-
Open Safari and open the following link (It was written by Ryan Petrich):
http://eagos.blogsite.org/files/fake-libgcc_1.0_iphoneos-arm.deb - Open MobileTerminal app on iPhone
- Type in “dpkg -i /var/mobile/Library/Downloads/fake-libgcc_1.0_iphoneos-arm.deb”
- Open Cydia and install “GNU C Compiler”, “C++ Standard Library”, and “ldid”.
-
Now you need the headers and libraries. (Can’t upload files because of copyright issues)
- Make sure you have the iPhone SDK installed on you Mac OSX.
- Go to the following folder /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/usr/lib
-
Use Diskaid or other iphone browsers to copy all the files to iPhone to directory
/var/mobile/Documents/lib -
Now we have to link it to /usr/lib/lib/
(The headers and libraries are huge so it’s better to store them in the larger partition and then link it in the system partition.) - On iPhone, open Mobile Terminal and type in “ln -s /var/mobile/Documents/lib /usr/lib/lib”
-
Go to the following folder
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/usr/include/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/usr/include/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/usr/include
- Use Diskaid or other iphone browsers to copy all the files to iPhone to directory /var/mobile/Documents/include
-
Now we have to link it to /usr/include/incl
(The headers and libraries are huge so it’s better to store them in the larger partition and then link it in the system partition.) - On iPhone, open Mobile Terminal and type in “ln -s /var/mobile/Documents/include /usr/include/incl”
-
Now you need to know how to compile.
- Open Mobile Terminal on iPhone
-
Type the following for iostream support.
g++
(input.cpp) -o (output) -I/usr/include/incl/c++/4.2.1/ -I/usr/include/incl -I/usr/include/incl/c++/4.2.1/armv7-apple-darwin9/ -I/usr/lib/lib/gcc/arm-apple-darwin9/4.2.1/include/ -L/usr/lib/lib/ -
Now you need to sign the code.
Type on iPhone Terminal: ldid -S (output) - Now run your application