Thursday, March 27, 2008

iPhone SDK Beta 2 PPC Fix

So Apple released the second beta of their iPhone SDK today...

I work on PowerPC Macs because I haven't felt the need to plunk down a couple thousand dollars for another computer when my Powerbook still works perfectly fine. I did, however, purchase an iPhone, and I'd really like to develop applications for it. Considering the fact that I paid almost $600 (after activation, etc) for the thing, and I previously dropped $2500 for the PowerBook, I feel that Apple owes me something for the money spent.

The previous version of the iPhone SDK didn't install the Aspen platform packages on PPC, but you could still manually install those packages and compile for the simulator with a simple warning about your unsupported (ppc) platform. Apple changed that with the second beta. First, the Aspen packages have now been prefixed with 'iPhone'... No big deal. Second, they've unfortunately made it a compilation error to attempt to compile for the iPhone simulator using a PPC computer. I find this unacceptable and I’d like to pay bills rather than buy new computers, so here’s what I did:
  • Once you've moved the iPhone platform directories to their appropriate location under /Developer/Platforms, drill into: /Developer/Platforms/iPhoneSimulator.platform/Developer/
    Library/Xcode/Specifications/
  • In this directory, you will find a file called "iPhone Simulator Architectures.xcspec" Make a backup of it and open the original in your favorite editor
  • You'll notice in this file that the 'RealArchitectures' variable only defines i386 as a valid architecture. I change that to "(i386, ppc)"
  • What I did next was essentially steal some of the definitions from the Mac OS X Architectures.xcspec file and added them to the end of the file.
The end result can be found here and can be used as a drop-in replacement of your "iPhone Simulator Architectures.xcspec". Make sure you back up the original though, or be prepared to reinstall.

After changing the file and relaunching XCode, my iPhone Simulator builds run fine... Not even the original warning. Wonderful!

[April 9, 2008 Note: This also works with the iPhone SDK Beta 3]

Technorati Tags: , , ,

26 Comments:

At March 27, 2008 9:01 PM , Anonymous Mike Rundle said...

Fantastic work! I was pretty upset they changed a compile warning to a compile error just for the hell of it, and I'm going to give your steps a shot in a little bit and see if I can get things back up and running again.

 
At March 27, 2008 9:01 PM , Anonymous Paul said...

Bingo! Thanks for sharing.

 
At March 27, 2008 9:08 PM , Anonymous Paul said...

Sorry about the double post–I'm a little too quick with the mouse.

I can't wait to see what else they may throw at us PPC users for the next update. I know the writing's been on the wall for a while now, but this still seems a bit ridiculous. Anyway, thanks for the workaround.

 
At March 28, 2008 3:29 AM , Anonymous alastair said...

And the NDA that you promised to adhere to in order to get the SDK?

 
At March 28, 2008 8:05 AM , Blogger Tom said...

What we're talking about here are the architectural specification templates that are a capability of the Xcode IDE; an IDE which is also distributed separately from the actual iPhone SDK, including as part of the Leopard distribution and retroactively not bound by iPhone SDK NDA.

By your logic, you could also say that people telling the world it is possible to manually install the iPhone platform packages is also bound by NDA, which it surely is not. 'Installing packages' has been a common occurrence since the beginning of Mac OS X.

 
At March 28, 2008 10:36 AM , Anonymous Paul said...

thanks.

 
At March 28, 2008 6:38 PM , Anonymous Paul said...

Speaking of which...anyone had any luck digitally signing their apps on PPC?

When that build phase runs, codesign keeps spitting out:

"object file format invalid or unsuitable"

It's finding my certificate and all that, but it doesn't like the executable for some reason.

 
At March 29, 2008 9:12 PM , Blogger Taehan Kim(김태한) said...

That's great!
I'm iMac G5 user, and I was very upset about that last night. But now, my project be runnable again.
Thank you.
(from Seoul, Korea)

 
At March 30, 2008 1:51 PM , Blogger Paul said...

Thanks for the code - works great!
Question for the masses: when you run the simulator, do people still get the "Aspen" sim, or the new "iPhone" sim?? I'm still getting the Aspen one by default!

 
At March 30, 2008 3:30 PM , Anonymous Paul said...

When I installed beta 2, it removed the Aspen items. During the install, I manually changed the install folder to /Developer...maybe that's what did it for me.

 
At March 30, 2008 4:51 PM , Blogger Jean-Pierre said...

I get this error too. Same thing:

2008-03-30 19:47:32 [0x0-0x177177].com.apple.iphonesimulator[28541] Expected in: /usr/local/lib/libsqlite3.0.dylib

Please post a fix if you find one, I'll do the same.

 
At March 30, 2008 9:49 PM , Blogger Tom said...

Jean-Pierre, I had the same problem on one of my Leopard updates. The problem occurs because the simulator was linked against the sqlite shared library in /usr/lib while the version in /usr/local/lib exports incompatible symbols. I believe the incompatible version was one that I installed when still running Tiger. I remedied my problem by removing the version of the sqlite application and libraries under /usr/local

 
At April 1, 2008 1:05 PM , Anonymous Motorized Citrull said...

Thanks a lot!
Happy owner of PowerBook 12" and Mac mini G4

 
At April 6, 2008 12:36 AM , Anonymous Motorized Citrull said...

Any luck in compiling for the iPhone without the certificate?
I just compiled for the simulator, then copied the bundle into the iPhone:the app appears in the screen but after launch it doesn't work.
I'm going to play with project settings...

 
At April 6, 2008 4:35 AM , Anonymous Anonymous said...

Yes! It works!
Thanks alot!

 
At April 8, 2008 4:49 PM , Anonymous leon said...

is sdk 3 fixable in the same manner?

 
At April 9, 2008 7:37 AM , Anonymous Anonymous said...

This fix appears to work for the iPhone SDK beta 3.

 
At April 9, 2008 11:20 AM , Anonymous Anonymous said...

I concur.
It sure appears to work with Beta 3 as well.

 
At April 9, 2008 11:22 AM , Blogger Tom said...

Yep, I had the same results. Going to add a note to the original post.

 
At April 11, 2008 6:47 AM , Blogger praveen said...

Thanks for your help in solving the ppc problem.

I am able to develop and test my code on iphone simulator now.

But when i try to build it for device,it says "Device not connected" even though i can see the iphone in itunes.

Please suggest the way to transfer our developed app on iphone.

 
At April 24, 2008 5:34 AM , Blogger nunofgs said...

works on beta 4!

 
At April 24, 2008 1:49 PM , Anonymous Paul said...

Did you have any issues w/the code signing? Up until know, when building for the device, if I set the project up to sign the code and the code signing build step runs, it would always throw an error stating "object file format invalid or unsuitable". Just wanted to make sure I can still deploy to the device w/beta 4.

 
At April 25, 2008 2:07 AM , Anonymous dharm said...

does it work on 10.4.11 Tiger or is it Leopard specific ?

 
At May 8, 2008 12:47 AM , Anonymous Webb said...

I just want to say thanks for posting this, and confirm that it works with Beta 5.

 
At May 10, 2008 7:50 AM , Anonymous Robert said...

Whooo hooo!

Got beta 5 working with opengl and everything. Thank you kindly for the fix.

 
At May 17, 2008 7:25 AM , Anonymous Fynnx said...

Thanks man, I'v now finally got beta 5 running on my G4!!!!
you've saved me a pretty penny :P

 

Post a Comment

Links to this post:

Create a Link

<< Home