You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"Bad CPU Type In Executable"

After upgrading from an eMac to an Intel Mac Mini, I noticed that I needed to reinstall Xcode. Once I reinstalled Xcode (v2.4), I made some changes to one of my applications. After testing it fully on my new Mac, I copied the .app file to my old eMac and attempted to re-run. In doing so, I received the following error message:

"You cannot open the application 'NAME OF APPLICATION' because it may be damaged or incomplete."

So, in Terminal, I navigated through the Package Contents to the actual executable and tried to run it. I, then, received the following error:

"Bad CPU type in executable."

How do I correct this error, so it will run on both of my Macs??



THANKS IN ADVANCE!!

WBELL

eMac Specs:
1GHz, 768MB DDR, OSX 10.4.x
Mini Specs:
1.5GHz Core Solo, 1024MB DDR2, OSX 10.4.x


Mac Mini Mac OS X (10.4.7) 1.5GHz Core Solo





Posted on Sep 19, 2006 1:26 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 19, 2006 2:56 PM

You need to compile it as a "universal" binary. There's a menu in the project settings where you can select the desirec target architecture(s), in which you'd want to select both powerpc and intel (or ppc and i386, or whatever the labels are in your xcode).
14 replies

Sep 21, 2006 1:08 PM in response to Daniel Macks

I went into "Edit Project Settings", from the "Project" menu. Under "General", there is a section called "Cross-Develop Using Target SDK". This was, and is, set to "Mac OS X 10.4 (Universal)". I saw nothing that allowed me to choose PowerPC and/or Intel CPU types. I also tried rebuilding the project using "Mac OS X 10.2". This still didn't work. I still get the same errors, using either selection. There's got to be an easier solution that I'm missing. Any ideas?


Thanks!

WBELL

Sep 28, 2006 9:58 AM in response to WBELL

I believe you have to make the change to the "Architectures" setting for each of your build configurations... so, for example, if you made the change while you were working on a "Debug" version of your app and later switched to a "Release" version, built and moved the app across to your other machine... the Release version would not have the dual-architecture setting.

Go back to the "Build" tab in your Project Settings and use the pop-up menu at the top to check both the "Debug" and "Release" configuration to make sure PPC and Intel are set for both of them.

Steve

EDIT: Also make sure the "SDK Path" is set to "/Developer/SDKs/MacOSX10.4u.sdk" for both configurations.

Sep 28, 2006 11:10 AM in response to WBELL

Hmm.. I'm not sure what to suggest...

If you select your built application in Finder and do a "File -> Get Info" what does it say next to "Kind:"? It should say "Application (Universal)".

If it doesn't say it's universal then something's still not right with your build settings... Maybe try doing a "Clean" and then another "Build"???

If it does say it's universal... but still gives you the error that it's not built for that architecture... I'm not sure what to suggest... :^(

Steve

Oct 4, 2006 9:43 AM in response to WBELL

At this point I'm not sure what to suggest. Maybe your build results window would have some clue. Do a "Build->Clean" on your project, then select "Window->Tools->Build Results" to open the build results window. Then click the "Build" button to rebuild your app.

When I build a Universal binary the build results window shows several "Copying" steps, then a couple of "Precompiling" steps, followed by "Compiling" for each of my .m files, then "Building ZeroLink launcher"... then a second set of "Compiling" steps for each .m (for the second architecture), then another "Building ZeroLink launcher" and finally a "Creating Universal Binary" step.

What are you seeing in your build result window? Do you see the second set of "Compiling" steps?

Steve

Oct 12, 2006 11:50 AM in response to WBELL

Here are a couple of things to check...

First, from your screen shot it appears that the main.m file is from an older AS Studio application (ie is this a project that was originally created some time ago... perhaps under Project Builder?). The main.m file that gets included with relatively new AS Stdio apps looks like this:
<pre>
extern void ASKInitialize();
extern int NSApplicationMain(int argc, const char *argv[]);

int main(int argc, const char *argv[])
{
ASKInitialize();

return NSApplicationMain(argc, argv);
}
</pre>
So you may want to copy/paste the main.m code from a newly created AS Studio app into your (older?) existing project. I'm not sure the above problem would cause the failure to build a Universal app, but changing code in main.m may get rid of the warnings you're seeing.

But also, the screenshot made me wonder if your target(s) needs to be converted to the newer "native" target format (this is different from the "conversion" that Xcode does to an older project file). With your project open click on Xcode's "Project" menu... is the option "Upgrade 'YourTargetName' to Native Target" or "Upgrade all Targets in Project to Native" available? If so, I think you must convert to native targets in order to build universal binaries.

Hope this helps,
Steve

"Bad CPU Type In Executable"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.