Installing the iPhone Toolchain (continued)
I posted previously that I was struggling to get the iPhone toolchain installed to my OS X Leopard Macbook. I’ve spent another few hours this evening/morning getting it up and running (whilst watching the Dolphins _finally_ win a game!) successfully.
It’s a bit of an amalgamation of how-to’s, forum posts and the ‘official’ cheat-sheet. Although I don’t seem to be the only person having problems, most seem to be with Macs upgraded from Tiger to Leopard, even though mine is a clean install (I mean it came pre-installed).
It also doesn’t help that i’m new to OS X (and not overly familiar with developing on Linux based OS) so a lot of the commands and output don’t really mean much to me right now!
Anyway, this is what worked for me:
Firstly, even though i’d already installed XCode and associated tools from the OS X 10.5 CD, I re-ran the installation as I had been getting the following error when building anything via gcc:
checking build system type… i686-apple-darwin9.1.0
checking host system type… i686-apple-darwin9.1.0
checking target system type… i686-apple-darwin9.1.0
checking type of operating system we’re going to host on… Darwin
checking target architecture… x86
checking for gcc… gcc
checking for C compiler default output file name… configure: error: C compiler cannot create executables
See `config.log’ for more details.
I don’t know what had put that up the spout from my initial install of it all but reinstalling fixed that error right off the bat.
- I created a folder ~/iPhoneDev to hold the source and makes that you are about to download.
- Following This Cheatsheet, follow the instructions for LLVM SVN (rev 42498), the iPhone-dev SVN and odcctools.
- I already had the decrypted iPhone file system so mv’d that to /usr/local/share/iphone-filesystem. (hint: Google “iPhone Decrypt Heavenly”).
NB. To save on confusion and because I have had problems with this before, I used the same folder naming as the cheatsheet, for example /usr/local/arm-apple-darwin and /usr/local/share/iphone-filesystem - just to make sure that I wasn’t mistyping a path or something stupid. - Continue to follow the instructions, setting the $HEAVENLY variable, updating the header files and installing csu.
- Here is where I ran into problems. The SED command was really mucking the install up. Trying to configure the LLVM-GCC source kept bombing out with “../../llvm-gcc-4.0-iphone/configure: Permission denied” errors. I’m not the only one that got this either. Thankfully, buried in Google, I found this page from a chap called Dallas Brown. To save flicking between his page and the instructions, i’ll paraphrase him here - full credit to Dallas however, I wouldn’t have gotten past this without his post.
AT THIS POINT, YOU SHOULD HAVE JUST “POPD”d OUT build/csu BEFORE FOLLOWING ON, THIS REPLACES THE LINE “sed ’s/^FLAGS_FOR_TARGET=blahblahblahblah…….” - Run, without quotes: “cp llvm-gcc-4.0-iphone/configure llvm-gcc-4.0-iphone/configure.old”
- Run, without quotes: “vi llvm-gcc-4.0-iphone/configure”
- Within vi and without quotes:
a. Type “/” (This starts a search)
b. Type “FLAGS_FOR_TARGET” (hit enter)
c. Type “/” (again, hit enter)
d. You should now be at the line containing just “FLAGS_FOR_TARGET=”
e. Type “i” (this enters insert mode)
f. Cursor to the end of the “FLAGS_FOR_TARGET=” line and add “${FLAGS_FOR_TARGET-}”
g. Hit Escape then type “:wq” (that’s colon followed by w followed by q - then hit enter to quit and save) - Now, back to the line _AFTER_ the sed command (you should ignore that sed line completely). Continue through from the “ln -s” line right through to “make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn”
- If that works, you’re golden and the make install should work fine.
So, where does that leave me?
Next I got hold of the 1.1.2 header package from TUAW and reran the header installation. That copied the .h files to the /usr/local/arm-apple-darwin-include/ folder.
The compiler is now whinging about Foundation/foundation.h including missing header files (NSCodingProtocol.h, NSCopyingProtocol.h and NSMutableCopyingProtocol) and also moaning about incomplete variable types (i assume because the headers are missing).
Google hasn’t been my friend with those missing headers just yet and i’ve run out of steam this morning - my alarm clock goes off in under an hour
Why is this so difficult?!
To be continued…….
Technorati Tags: iphone, toolchain, xcode, headers, damn i’m tired
You can also subscribe via FeedBurner and receive my latest posts by email. If you prefer to use an RSS reader, you can subscribe using this link.
[...] going back through the steps in my post yesterday, i’ve been able to make the HelloWorld example UIKit app and get it working on the iPhone. [...]
Hi,
I have written a HOWTO for building a working 1.1.2 toolchain (or previous versions) under Leopard - get it at:
http://groups.google.com/group/jiggyapp-devel/web/iphone_leopard_toolchain_howto.rtf
It is a full step-by-step guide that includes downloading all the tools, firmware files, decryption utils, plus all the workarounds that fix the build process and the extra commands necessary to fix the holes in the current documentation on other sites.
Hope it helps.
Cheers,
DamHack
Cool, nice one.
I’m not sure that Apple (or maybe Google) will be overjoyed with the decrypt key being up there.
I think that’s why all the other guides point at HOW to get the key rather than spinning the actual key out there.
Just MHO obviously :).
Let’s just hope that the SDK release doesn’t end up being a let down and actually provides something worthwhile.
Some iPhone Interface Builder assets would be awesome.
I’ve actually un-jailbroken my iPhone for the moment - some (most) of the apps seem to have big memory leak problems and Springboard just kept crashing out every so often, to the point where it was really annoying.
It also seemed to eat into the battery life big time.
Hey, yes, I had to uninstall XCode 3.0 (previous version) using the Terminal window. Then installed the new SDK from he apple site. Now I am able to build the LLVM no problem!