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.

  1. I created a folder ~/iPhoneDev to hold the source and makes that you are about to download.
  2. Following This Cheatsheet, follow the instructions for LLVM SVN (rev 42498), the iPhone-dev SVN and odcctools.
  3. 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.
  4. Continue to follow the instructions, setting the $HEAVENLY variable, updating the header files and installing csu.
  5. 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…….”
  6. Run, without quotes: “cp llvm-gcc-4.0-iphone/configure llvm-gcc-4.0-iphone/configure.old”
  7. Run, without quotes: “vi llvm-gcc-4.0-iphone/configure”
  8. 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)
  9. 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”
  10. 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: , , , ,