Using the iPhoneOS SDK on older PPC Macs


I'm just getting started with developing applications for the iPhone / iPod Touch, and one of the first real hurdles I encountered was that Apple didn't make it easy by default to use their iPhoneOS SDK on non-Intel Macs. With some Googling around I was was able to find a variety of articles that mentioned workarounds, but the comprehensive solution was spread across lots of blog post comments, forum postings, etc. So, for my own reference and hopefully as assistance to anyone else who might be in the same boat, I'm consolidating the steps here.

I'm using a 1.5GHz Powerbook G4, which uses the PowerPC (PPC) architecture. I downloaded version 2.2 of the iPhoneOS SDK, build 9m2621-final.

After the regular installation of the iPhoneOS SDK (which is really just the regular Xcode install with some additional packages thrown in) was complete, the Xcode new project menu was notably missing the option to choose the iPhone platform. On the advice of this 3by9 article, I took these steps:

  1. Mount the SDK installer disk image
  2. Open the packages folder
  3. One at a time, install all of the .pkg files that begin with "iPhone", using the default install destination
  4. When done, you'll have a "Platforms" directory in the root level of your Mac's hard drive. Move the contents of that directory into the /Developer/Platforms/ directory. If you're like me, when you're done, you'll have three directories in /Developer/Platforms: "iPhoneOS.platform", "iPhoneSimulator.platform" and "MacOSX.platform".

Once that step is done, you'll be able to launch Xcode and create new projects that use the iPhoneOS platform and application types. But, you still won't be able to build or run those applications, because Apple has hardcoded the "i386" (Intel) architecture as the only valid one to compile for. Thanks to a variety of comments on the above 3by9 post and comments 23-25 on this TUAW article, here are the remaining steps to address that:

  • Close Xcode and edit this file (perhaps after making a backup): /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec
  • Change line 12 to read Name = "Standard (iPhone Simulator: i386 ppc)";
  • Change line 16 to read RealArchitectures = ( i386, ppc );
  • Add this chunk before the last closing parentheses:
         // PowerPC
         { 
              Type = Architecture;
              Identifier = ppc;
              Name = "PowerPC";
              Description = "32-bit PowerPC";
              PerArchBuildSettingName = "PowerPC";
              ByteOrder = big;
              ListInEnum = NO;
              SortNumber = 106;
         },
  • Save the file and close it. Now relaunch Xcode.
  • With Xcode open and your project loaded, right click on the project name under the "Groups & Files", and select "Get Info"
  • Under the "Build" tab and in the "Architectures" menu, change these options:
    Set Architectures to "Native Architecture of Build Machine"
    Set Base SDK to "Simulator - iPhoneOS 2.2"
    Leave Build Active Architecture Only checked
    Edit Valid Architectures to be not only include armv6, but also "ppc" and "i386".
    (I think some of these may be redundant, but it's the combination that's working for me.)

When you next build your project, you shouldn't get any errors about VALID_ARCHS.

I hope that's helpful. Since this is only one particular combination of build hardware/architecture and SDK software version, I'm sure there are other combinations out there where the above may not work, your mileage may vary.

Now, back to working on building an actual application...

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading ... Loading ...

Have something to say about that? Read and add comments below.

Related Posts

If you thought that was interesting, you might also enjoy these related posts:

This page is part of my weblog, which is a part of my personal website.

Discussion
and Links

Join the discussion by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
Prev: WhatIsYourStory.org, an oral history project in Richmond
Next: EDC Board Appointments: Ready for Battle!

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

As my friend Ian said (approximately): 'Comment sections on articles like this can get nasty sometimes. This is my blog, and it won't get nasty because I'll moderate those comments. Mean people have a whole Internet at their disposal; this place is mine.'

Your comment:

Reader Comments

So how well is it working for you on PPC? Which version of OS X? I am getting the new OS X bundle at the end of the month, and I am running PPC, and I would like to port some of my games over to the iphone/ipod touch.... Let me know how well it works and if you can get the applications to run sucessfully on the iphone/ipod touch. Cheers!

Thanks a lot. It was very useful.
In fact, it is working very well now.
I have the same machine than your. Now, I have to learn how to develop in this platform.

I followed the instructions to the letter and cannot run xcode. I'm running a Dual G5 with OS X 10.5.6 and iPhone SDK 2.2.
I get the message below when trying to run xcode:
***********
File: /SourceCache/DevToolsBase/DevToolsBase-1148/pbxcore/SpecificationTypes/XCPlatformSpecification.m
Line: 424
Object:
Method: loadAllPlatforms
The Mac OS X platform is missing - cannot set a default platform.

If I move the platforms directory BACK to just /Platforms I CAN run xcode with NO errors. However, when I try and build the example "MoveMe" application written by apple, I get :
***********
Line Location MoveMeView.xib:0: Command /usr/bin/ibtool failed with exit code 1
Line Location MoveMeView.xib:0: Description: ibtool failed with exception: IB requires the Cocoa plug-in

*******

[...] vi posso confermare che l'UNICA procedura funzionante (almeno per il mio ibook G4) è la seguente: Using the iPhoneOS SDK on older PPC Macs - Chris Hardie's Blog Seguendo la procedura scrupolosamente ho un installazione dell'iPhone SDK 2.2.1 (l'ultima ad oggi) [...]

Hey Guys, I can assure this is the ONLY working procedure!!! I tested a lot of other procedures described on the net (Pacifist,ecc) and this one rocks!!!It works perfectly for iPhone SDK 2.2.1 on an ibook G4 1.42 Ghz with Leopard (10.5.6)....Thank you Chris....you are the Man!!

Wow Chris you saved me $ 600... I allmost thought I had to buy an intel mac. Considered I had allready bought Leopard to upgrade my Imac G4 "17 PPC. Think it is not like apple at all to do this... Thanx man.

Andy.

Hi Chris,

Did you ever get an aplication on your Iphone ? I have done everything... registered, so I have all certificates but it keeps giving me an error. I read this is a well known problem but I wondered if you might have tackeled it. Seems to be a problem to be solved with codesign.orig But I don't have any knowledge on compiling files, etc. So far I can only test in emulator and not on my phone. I have SDK 2.2.1 and Iphone software is the same I believe...

Thanx,

Andy.

Hi Chris,

Nice article! Worked perfectly fine, until I've encountered a bump regarding the iPhoneSimulatorArchitectures.xspec. It seems that in my case, I replaced:

/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec

and NOT

/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec

(I got the tip from Spiced Ham's comment, comment # 23
http://www.tuaw.com/2008/03/27/iphone-sdk-beta-2-now-hitting-the-streets/2#comments
)

Add ppc to RealArchitectures in:

/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec

Note: is not /Developer, then you need to make a link from /Developer/Platforms to /Platforms, as the WebKit framework used by the iPhone simulator expects to find CoreGraphics under /Developer/Platforms. If you don't do this, the simulator will fail to run.

Excellent comprehensive solution! The only thing I had to change was the default location for the all the iPhone*.pkg installations to /Developer otherwise it will just plonk them into /

If your default was /, then just move the directory to /Developer or wherever you installed Xcode. Works fine after doing this so far.

Thanks again!

Thank you so very much, took me about 6 hours googling, and another 3 of installing and re-installing, but following your guide I finally got the simulator to pop up. Even better no more of those error buttons popping up on the bottom right! Thanks again, this is the best guide to getting ppc to work.

Thanks for the instructions, they work like a champ for the 2.2.1 SDK.

One missing step is on #3 when installing anything that begins with iPhone* also make sure you install the DeveloperDiskImage.pkg if you want to run your apps on a "real" device, not just the simulator.

Also, one sad note. It appears that with the upcoming iPhone OS 3 Apple has decided to make the Simulator an Intel ONLY binary... meaning, the simulator won't even launch on PPC based Macs :-(

Brilliant! Worked perfectly for me. Thanks a million for pulling all that together and posting!

I also get the same error on my PowerBook G4 as Dan:

Description: ibtool failed with exception: IB requires the Cocoa plug-in

please help!

@Dan and Tom: did you follow the advice to move the _content_ of /Platforms to /Developer/Platforms not the folder itself. So in /Developer/Platform there must be still the MacOSX.platform?

But I've still the problem to install the apps over the organizer to the iPhone. Any Codesigning issues I foreclose because I can install the apps with iTunes and they run! But for Debugging I've no chance. Any time I tried I got 'unexpected Error (E8000001)' (without any comment) and I think before any transmission to the iPhone. There are no messages about this in the Console.
I hoped withe Jasons Tip I get further, but nothing changed. :-(

BTW: @Andy: the codesigning problem is solved with 10.5.7!
So can anyone help me?
I've G5 Quad with 10.5.7 and SDK 2.2.1 and iPhone classic
Thanx
chappell