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: , , ,

60 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

 
At May 30, 2008 12:51 PM , Anonymous chris said...

Works with beta 6 too!

 
At June 2, 2008 5:29 PM , Anonymous Mach said...

I had problems with beta 6, even with this fix. I was able to get my application to build but when I went to simulate, it hangs at the step "GDB: Installing XXX in Simulator". It doesn't even start up the simulator. I tried it again with the Metronome example app and got the same results.

Has anyone else encountered this?

 
At June 4, 2008 5:23 PM , Anonymous Webb said...

Just another verification this fix works with beta 6 and the demo apps.

 
At June 6, 2008 3:53 PM , Blogger David said...

Thanks so much for sharing! I can now build & run "Move Me" sample on my 15" PowerBook G4. Awesome!

 
At June 10, 2008 6:08 AM , Blogger Jeroen said...

This also works for Beta 7 of the iPhone SDK. I did put "ppc7400" in RealArchitectures though instead of "ppc" as I have a PPC G4.

"ppc" defines the G3 architecture, and "ppc7400" the G4 one.

 
At June 12, 2008 12:24 PM , Anonymous andrew said...

you just saved me $600... was about to go out and buy a mac mini just for iphone development.

w00t!

 
At June 15, 2008 9:31 AM , Blogger Sceenz said...

Mach said:
it hangs at the step "GDB: Installing XXX in Simulator"

I was able to get apps running this way:
on a G5 dual 2.0 64 bit:
edit your .xcspec as follow:
line 12;
RealArchitectures = ( i386, ppc970 );

then add before the last line:
// PowerPC
{ Type = Architecture;
Identifier = ppc;
Name = "PowerPC";
Description = "32-bit PowerPC";
PerArchBuildSettingName = "PowerPC";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 106;
},

// G5 32-bit
{ Type = Architecture;
Identifier = ppc970;
Name = "PowerPC G5 32-bit";
Description = "32-bit PowerPC for G5 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 203;
},

)

then Do this:
first build.
then Run:
"start with performance tool " "activity monitor"
and you will see your app running on the simulator!

hope this help!

 
At June 25, 2008 11:04 AM , Blogger FrozenPosen said...

Works smoothly on Beta 7!
Thanks for fantastic workaround...:)You helped me to save at least 1.5$K!

 
At July 1, 2008 12:10 PM , Anonymous Anonymous said...

It works on beta 8 as well.

Thanks for all the help, its nice for people like you to help the less mac-savy people out there.

 
At July 1, 2008 3:15 PM , Blogger spongebob said...

Excellent, I bought an iBook G4 off ebay (my first apple) specifically for developing for the iPhone after seeing your instuctions. I installed the iPhone SDK (build 9M2199a, beta 8) and after following your instructions I have the MoveMe application compiled and running inside the Simulator.

Many many thanks,
Lee

 
At July 3, 2008 7:08 AM , Anonymous Anonymous said...

I can get this working by using the Activity monitor but I cannot figure out how to debug within the simulator. it just hangs when says Installing in Simulator. Has anyone gotten debugging to work?
Thanks,

 
At July 11, 2008 3:41 AM , Blogger Isabel said...

Hi there, i have a mayor trouble trying to compile. I can run aplications on Simulator but i cant compile to Device. If i change to Device Xcode crashes leaving no clue.

Can any one help me? Thanks

 
At July 11, 2008 5:44 PM , Anonymous kanny said...

Hello, any news on official iPhone SDK 2.0 running on PPC G4 ?

 
At July 12, 2008 1:30 AM , Anonymous Paul said...

I've got it working on a PowerBook G4 with the 2.0 firmware and new SDK. I still can't compile signed code. (I have all the proper stuff and it sees my certificate)

Everything is up to date and it fully builds till the end except this.

I get this error (from codesign):
[long path to app]: object file format invalid or unsuitable


Anyone have a fix?

 
At July 13, 2008 7:55 PM , Anonymous Anonymous said...

Paul,

I'm in the same boat as you, PB G4 and wanting to build some apps. I wasn't sure how the code signing and certificates would work on a PPC machine. There is an Intel Mac in my house, but it's not mine, and I can't be developing on it all the time. I might just have to buy a Mac Mini on the cheap to get things rolling for now.

 
At July 18, 2008 3:09 AM , Anonymous Luke Sands said...

I'm having the same problem with codesign (object file format invalid or unsuitable) on a Powerbook when trying to build for the device.

Anybody found a workaround?

 
At July 21, 2008 7:30 PM , Anonymous Anonymous said...

I'm on G5 using SDK Beta-8 (5a345) and I can successfully build for the device. I had to install manually one more package called "DeveloperDiskImage". But when I try to run, I get the following:
>>>
Your mobile device has encountered an unexpected error (0xE8000001) during the install phase: Verifying application
<<<
However, I haven't applied for the iPhone Dev Program yet. Is this required ? (and pay at least $99...)

IMO, with Beta-8 (and the "final" SDK, which appear to be identical) it's better to install iPhone packages directly under "/Developer" so that installed files go straight to their respective folders.

 
At July 23, 2008 6:36 PM , Anonymous Eric said...

Yes, unfortunately, you do need to pay the $99 dollars. The error you are running into is referring to when it tries to verify the code signing.

However, even with the $99 certificate, you can't use the codesign application on a PowerPC, I am currently looking for a way around it.

In the meanwhile, jailbreaking should fix your problem.

 
At July 26, 2008 3:16 PM , Blogger Nathaniel Troutman said...

What version of OS-X is everyone using when they are getting the iPhone Simulator running on their PPC?

 
At July 28, 2008 7:16 AM , Blogger ravi said...

hi
i am also facing same problem for code sign for device with exit status 1 for ppc.anyonne knows please help me...

 
At July 28, 2008 1:41 PM , Blogger webocratize.us said...

This post has been removed by the author.

 
At July 29, 2008 9:59 PM , Anonymous shiny said...

Same problems here trying to code sign to run on the phone from a ppc G4.

*sigh* if anyone has any knowledge about how to hack it so the powerpc version of codesign will work, that'd be wonderful.

 
At August 14, 2008 9:57 AM , Anonymous Anonymous said...

Thank you. This worked perfectly.

 
At August 20, 2008 10:52 AM , Blogger Wesley said...

Here's a thread with a solution to using codesign on PPC:

http://discussions.apple.com/thread.jspa?threadID=1455699&tstart=0

About to try it myself...

 
At September 3, 2008 12:32 AM , Blogger Daniel said...

Hey... thanks for sharing that. i dugg your article as well.

 
At September 11, 2008 3:14 PM , Anonymous jkirby said...

I just downloaded the new 2.1 SDK, did the manual iphone pkg installs and it blows up Xcode 3.1 when the Simmulator tries to load.

Running 10.5.4 PPC

The previous hack worked fine ... this appears broken

 
At September 12, 2008 2:55 AM , Anonymous Anonymous said...

Hello am new to iphone programming and also Mac, I have a powerpc g4...I have a few questions:
1.) I have installed the sdk using pacifist without which the iphone listing does not get displayed. Is it possible to install directly on it n still avail all the features
2.)Iget the error ibtool cannot open files of this type...my application does not run properly on the simulator kindly tell me how to go about this...

g4 config:1.25Ghz powerpc g4
1GB DDR SDRAM
Mac OS X version 10.5.4

 
At September 12, 2008 2:59 AM , Anonymous Anonymous said...

oops sorry forgot to mention I have iphone OS version 2.0..n ipod touch...iphone sdk build 9M2199a

 
At September 12, 2008 12:38 PM , Anonymous Anonymous said...

When i try to compile app i get this error:
Uncaught Exception:
*** -[XCiPhoneSimulatorDevice setCurrentExecutable:]: unrecognized selector sent to instance 0x2e6da10

Stack Backtrace:
The stack backtrace has been logged to the console.
iphone sdk 2.1 ppc g4

 
At September 15, 2008 12:13 PM , Anonymous Anonymous said...

Does anyone know if this will still work with 2.1 ? Also is it really true that you can't sign code &or provision on a G5 ? Sounds ridiculous - I bought my Mac from Apple, why can't I develop on it ?

 
At September 15, 2008 2:55 PM , Anonymous Anonymous said...

Yeah, it still works for 2.1.

I'm just getting a stupid "Unable to locate a suitable developer disk image." now when I try to run it on my device... I thought I ran into this problem before, but I can't remember the solution.

 
At September 15, 2008 3:08 PM , Anonymous Anonymous said...

Oh yeah...

If anyone else runs into the "Unable to locate a suitable developer disk image." problem, there's a package called "DeveloperDiskImage" in the iPhone SDK that needs to be installed.

As of 2.1, these are the extra packages that you need to install manually:
iPhoneSDKHeadersAndLibs
iPhoneSimulatorPlatform
iPhoneHostSideTools
iPhoneDocumentation
DeveloperDiskImage

 
At September 16, 2008 7:20 PM , Blogger earnshavian said...

Brilliant. Many thanks

 
At September 17, 2008 7:01 AM , Blogger Hessi said...

Hey everybody...

i tried to run a helloworld.app on iphone 2.0.2. After hours and hours i can send the app to my iphone... but when the iphone want to start the app i get this message;

[Session started at 2008-09-17 15:52:57 +0200.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Mon Aug 11 05:38:47 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=powerpc-apple-darwin --target=arm-apple-darwin".tty /dev/ttys012
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-418-68
Switching to remote protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
sharedlibrary apply-load-rules all
run
Running…
Error launching remote program: security policy error.
Error launching remote program: security policy error.

I run it from a PPC.... any idea?

 

Post a Comment

Links to this post:

Create a Link

<< Home