Universal binary?

Member
Posts: 53
Joined: 2006.10
Post: #1
Hi,

is it possible to make a universal binary if I only have a PPC? (ibook) Or do I need to have an intel mac to make a universal binary?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
It's perfectly possible. It works exactly the same way as doing it on an Intel Machine. You will need Mac OS X 10.4 and Xcode 2.1 (or 2.2 if you want to be able to run your universal binary on Mac OS X 10.3.9 or earlier).
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #3
To turn your app into a universal binary all you have to do is change your target settings for "release".

In the build tab do the following:

Click on the Architectures and then hit the edit mode. Check both checkboxes (PowerPC and Intel)
Add a new setting called MACOSX_DEPLOYMENT_ppc with a value of 10.3 or whatever the minimum system version you need to support for PowerPC
Do the same for MACOSX_DEPLOYMENT_i386 but this value must be 10.4 or higher since Mac OS X only exists for Intel starting from 10.4

That's it, clean your project and build.

If you use thirdparty libraries that are not yet made universal you'll get errors. Either don't use them, or find out if there is a universal binary version of them. Or if the source is available, build them yourself as UB.

"When you dream, there are no rules..."
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #4
lipo -create file1 file2

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #5
unknown Wrote:lipo -create file1 file2 -output file3
Fixed that for you. Rasp That's the method I use: I build a PPC and Intel version, copy one of them, then run Lipo, dragging the binaries into the terminal window to copy the paths. (I set the PPC's SDK to the Panther SDK as well, so it's Panther compatible)
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #6
akb825 Wrote:I build a PPC and Intel version, copy one of them, then run Lipo, dragging the binaries into the terminal window to copy the paths. (I set the PPC's SDK to the Panther SDK as well, so it's Panther compatible)
I do this as well for 10.2 compatibility, but you can save yourself some time and work if you setup an aggregate target that builds both parts and includes a "Run Script" phase to run lipo automagically.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
If you have Xcode 2.2 or later, there's no reason to use lipo to create a UB that runs on 10.2; just follow Taxxodium's instructions.
Quote this message in a reply
Member
Posts: 53
Joined: 2006.10
Post: #8
Hi again.

Ok, thanks for the replies now I'm trying to get it to work but I don't use x-code >_>

I'm using a gui to do it for me so I just want to click a button and make universal binaries. It helps a lot to know it's possible though to make intel binaries eventhough I'm on a PPC Smile

thanks again!

I know i should learn how to use x-code one day. . .
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #9
You can use the -arch argument to gcc to compile as ppc (-arch ppc) or Intel (-arch i386). For the Intel one, you're going to have to link the 10.4u SDK, so you will need to add this flag:
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
After you create your 2 binaries, you can combine them with the lipo command.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #10
OneSadCookie Wrote:If you have Xcode 2.2 or later, there's no reason to use lipo to create a UB that runs on 10.2; just follow Taxxodium's instructions.
If you need a PPC-only build in addition to a UB build then lipo works out nicely. Granted that's not often the case, but it's exactly what I need for certain things (though I guess you could argue that splitting the UB is easier than combining it). Regardless, I find separate targets are sometimes easier to manage than multiple-defined compiler flags - but that's just me, use whatever ya like/works best for you and/or each project...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Creating universal binary(ppc/i386) with XCode 3.1.2 AdrianM 1 3,635 Apr 13, 2009 09:11 AM
Last Post: DoG
  Universal Binary on PPC : a few questions frozax 6 3,728 Mar 7, 2008 04:02 PM
Last Post: frozax
  Universal Binary skyhawk 3 2,969 Feb 4, 2008 11:52 PM
Last Post: sohta
  Universal Binary Problems DesertPenguin 1 2,263 Aug 3, 2006 07:37 PM
Last Post: OneSadCookie
  #import <ppc_intrinsics.h> for Universal Binary ? DanLab 22 9,902 Apr 16, 2006 10:28 AM
Last Post: DoG