|
Installing
How to install the toolchain to the iPhone.
Featured IntroductionHere are some simple instructions to install the toolchain to the iPhone. The guide assumes that BSD subsystem is installed. There is a bit of command-line work, so either SSH package or Terminal + iphuc must be installed. These packages were built and tested on firmware 1.1.4, but they may work on older firmwares, too (YMMV). DetailsAll the packages from this project will go in /usr/local on the iPhone, so make sure you have plenty of space. I chose to put my /usr/local on the Media partition. Here are the steps: $ cd Media $ mkdir local $ login -pf root Password: # ln -s /var/mobile/Media/local /usr/local # exit Copy gcc-4.0.1-iphone-1.tgz to the iPhone to /var/mobile/Media/gcc-4.0.1-iphone-1.tgz and unpack it: $ cd / $ tar -xzf /var/mobile/Media/gcc-4.0.1-iphone-1.tgz $ rm /var/mobile/Media/gcc-4.0.1-iphone-1.tgz Copy odcctools-9.2-ld-iphone-1.tgz to the iPhone to /var/mobile/Media/odcctools-9.2-ld-iphone-1.tgz and unpack it: $ cd / $ tar -xzf /var/mobile/Media/odcctools-9.2-ld-iphone-1.tgz $ rm /var/mobile/Media/odcctools-9.2-ld-iphone-1.tgz Copy make-3.81-iphone-1.tgz to the iPhone to /var/mobile/Media/make-3.81-iphone-1.tgz and unpack it: $ cd / $ tar -xzf /var/mobile/Media/make-3.81-iphone-1.tgz $ rm /var/mobile/Media/make-3.81-iphone-1.tgz Copy headers-4.0.0-iphone-1.tgz to the iPhone to /var/mobile/Media/headers-4.0.0-iphone-1.tgz and unpack it: $ cd / $ tar -xzf /var/mobile/Media/headers-4.0.0-iphone-1.tgz $ rm /var/mobile/Media/headers-4.0.0-iphone-1.tgz Okay, so you don't have headers-4.0.0-iphone-1.tgz; you have to build this package yourself. The following steps must be done on your MAC OS X computer if you arent on OSX see the next step below to obtain headers: $ svn co http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk $ wget http://iphone-gcc.googlecode.com/files/headers.patch.gz $ THISPATH=`pwd` $ INSTPATH=$THISPATH/usr/local $ MACOSXDK=/Developer/SDKs/MacOSX10.4u.sdk $ pushd include-1.2-sdk $ ./configure --with-macosx-sdk=$MACOSXDK --prefix=$INSTPATH $ bash install-headers.sh $ cd $INSTPATH/include && zcat $THISPATH/headers.patch.gz | patch -p1 $ cd $INSTPATH/include/c++ && ln -s 4.0.0 4.0.1 $ popd $ tar -czf headers-4.0.0-iphone-1.tgz usr If you aren't on Mac OS X, replace the /Developer/SDKs/MacOSX10.4u.sdk path with the full path to the unpacked Mac OS X 10.4 Universal SDK. If you don't have a copy of this, download the Xcode 3.0 DMG from Apple's Developer Tools download page. It is free, but you will need to register with them. Extract the Packages/MacOSX10.4.Universal.pkg directory from the Xcode DMG (use PowerISO, TransMac or plain old mount if on Linux). You'll also need xar: $ xar -xf MacOSX10.4.Universal.pkg $ gzip -dc Payload | cpio -i The last missing bit is headers.patch.gz, which will be available shortly. |
Is the user supposed to ssh at root or as mobile? If as mobile, what is the mobile password, as I can only seem to login as root using alpine. I thought mobile was dottie but it does not work.
when will the headers.patch.gz file become available and what is it and why is it needed?
Since most of these packages seems to be binaries, why not create a package installer inside the installer.app for a Jailbreaked 1.1.4 phone? You could put the headers in a separate package separate from you install.
It would be nice to see a follow up showing the hello world or another simple unix app being compiled many of these guides show installing, they skip the ssh part and also skip anything being compiled. I am familiar compiling apps on linux and Mac OS X, but how does the user really know if everything is installed properly? My experience has been compiling apps for x86 and powerpc has been a breeze, ARM has been a thorn in my side getting anything complex to compile and hammering out the configure logs is so "much" fun.
http://iphone-gcc.googlecode.com/files/headers.patch.gz no longer exists. Where can I find this file?
http://rapidshare.com/files/143660780/include.tar.gz.html
its work on IPHONE 3G with 2.1 firmware
its work on IPHONE 3G with 2.1 firmware????? zotinas@gmail.com
is there GCC iphone for 2.1 firmware??????
junxian.huang@gmail.com
I would really appreciate a step by step tutorial on transferring the header files from the iphone sdk to the phone. I'm stuck, and not really experienced enough with C to know what to do. I hope to remedy that by installing the GCC on my phone, but can't install it without being experienced enough to know what to do....
Help?
Is: http://rapidshare.com/files/143660780/include.tar.gz.html where I can find http://iphone-gcc.googlecode.com/files/headers.patch.gz?
I found that there are more than one directories in include.tar.gz which deltas4s has offered. And when using the command cd $INSTPATH/include && zcat $THISPATH/headers.patch.gz | patch -p1 to patch these files to MacOSX10.4u.sdk, it always says that it can not find the .Z file;god, is there any relationship with the .Z file? I'm confused.
And there are not only one include directory, so the command maybe doesn't fit. Then I tell by what way I work around this problem:
Just use the cp command to copy the /usr/include in include.tar.gz to /$INSTPATH/include;It can add new files ,overwrite different files and leave other files. Then my hello.c can be compiled correctly with no errors now.
But to make your first programm can print "Hello World!" succesfully, you should also download the Idid tool and use the 'ldid -S hello' command. If you are not familar with this, see this page:http://soi.kd6.us/2008/09/27/so-i-made-my-iphone-say-hello-world/ (focus on the section "After the Toolchain is Installed").
I have extracted the binaries using the commands above, but for some reason, when I try and compile my C hello world test app, the console reports that the app was killed "Killed". I am not sure whether this works at all ... do you guys have any other packages we can try or is this it? I am using an IPhone Jailbreak with Firmware 3.0.
if your app says "Killed" when you run it, you have to sign it. Run ldid -S ./AppName? Then run it.
Anyone have success building C++ programs? I have problems with iostream: No such file or directory.
I want to use iphone-gcc with my iPod Touch 2G (Firmware 3.1.2). So i installed the package iphone-gcc via cydia. The first three .tgz are unnecessary, because they are now installed to /usr. But I don't know how to obtain the headers.
I downloaded the whole iphone sdk (incl. Xcode, ~ 2.5 GiB). Xcode 3.0 seems to be old and I have only found xcode 3.2 or xcode 3.2.1. Can I use this new version of xcode?
The full filename is "iphone_sdk_3.1.2_with_xcode_3.2.1snow_leopard10m2003.dmg". I hope this is the correct image. But I can't mount this dmg. I tried "mount -t hfs -o loop file.dmg /mnt" and "mount -t hfsplus -o loop file.dmg /mnt", but it didn't work (no hfs superblock). Also an dmg2iso converter created only a unusable iso.
Maybe someone could help me. :)
Finally I did it. I extracted all things with windows and some tools.
Here is a great tutorial: http://www.theiphonewiki.com/wiki/index.php?title=Toolchain_2.0
But /usr/local/lib was also missing (Could not find -lSystem). I copied usr/lib from the sdk-tree to /usr/local/lib and now it works.
Thank you very much for your impressive work!
for some reason, every time i try to run gcc it says "killed"
any ideas?
I got it installed but when I attempt to compile:
int main() { return 0; }
Ends in a segmentation fault, any idea how to fix it? FYI: Used 'libgcc_s.1.dylib' as 'libgcc_s_v6.1.dylib'
I am trying to compile a c program on the iPhone. I have installed iphone-gcc using Cydia. My problem is that I don't have libSystem.B.dylib under /usr/lib on the iPhone. When I do otools which ls I do see that it IS linked against /usr/lib/libSystem.B.dylib. But the library is NOT there. Any ideas?
libSystem.B.dylib is part of 3.1.2 SDK. and you can to extract it by self
Can anyone upload the header files? I cant compile my app :-( i Soul apreciate if anyone uploaded a example to cuz my makefile i bugged too.
okay, so now whenever I try to run g++ I get a bus error... I'm trying to compile a hello world program...
Not working on 3gs or iPad :(
Hi,
After following the above steps i try to "make" a HelloWorld? Project and I get:
dyld: Library not loaded: /usr/lib/libgcc_s_v6.1.dylib
Why libgcc_s_v6.1.dylib is not included in gcc-4.0.1-iphone-1.tgz?
I hear libgcc has a tendency to brick newer devices, that's why it isn't included in Cydia either. These are just rumors, so I may be wrong.
Nevermind, solved.
How did you solve it? Posting these things would help others with the same problem.
Yes, sorry.
I installed the iPhone 2.0 toolchain and changed the PATH so that /usr/bin stayed first than /usr/local/bin, which is where the above gcc-4.0.1 package files are such as the (old?) arm-apple-darwin-gcc. I now use arm-apple-darwin9-gcc and the application is successfully compiled, linked and installed.
The library problem is gone.
Work on firmware 3.1.3 ????
http://code.google.com/p/iphone-gcc-full/