Search This Blog

Wednesday, December 23, 2009

How to compile 'Hello, World!' in iPhone gcc for iPhone OS 3.1.2

Step 1. You need iPhone gcc installed in your jailbroken iPhone with firmware 3.1.2

Step 2. Install libgcc

wget http://apt.saurik.com/debs/libgcc_4.2-20080410-1-6_iphoneos-arm.deb
dpkg -i libgcc_4.2-20080410-1-6_iphoneos-arm.deb

Step 3. Install iPhone gcc

apt-get install iphone-gcc

Step 4. Install make

apt-get install make

Step 5. Install ldid

apt-get install ldid

Step 6. Install heder files of tool chain and SDK 3.0

The building of iPhone gcc in Linux and header files is here:
The updated mobilesubtrate header files are here: http://svn.saurik.com/repos/menes/trunk/mobilesubstrate/
The class dump procedure is here:
However, there is 'sys30', that is the collection of header files and class dump somebody made already. You can download it here:

To place the header files and class dump, make '/var/toolchain' and place them in following way:

mkdir /var/toolchain/
cd /var/toolchain/
tar -xzvf /var/mobile/sys30.tgz

Step 7. Compile 'Hello, world!" and run


iPhone:~/helloworld root# make
arm-apple-darwin9-g++ -dynamiclib -I/var/toolchain/sys30/usr/include -I/var/toolchain/sys30/dump -c -o main.o main.c
arm-apple-darwin9-g++ -lobjc -L/var/toolchain/sys30/usr/lib -Wall -Werror -march=armv6 -mcpu=arm1176jzf-s -o helloworld main.o
ldid -S helloworld
iPhone:~/helloworld root# ./helloworld
Hello, world


2 comments:

  1. Thanks, but where and what header files should i download? And where should i place them?

    How can i make a app using terminal? Like executing a compile command?

    ReplyDelete
  2. ClixSense is an high paying work from home website.

    ReplyDelete

Blog Archive