views:

609

answers:

4

Hello,

Short question: How do you take two apps, one for intel and the other ppc, and package them into one Universal Binary?

My current thoughts on this problem:

I have read though the apple developer documentation on universal binaries and haven't been able to find an answer so it may not be possible.

Due to reasons I won't go into here I have two apps of my program (apposed to using xtools to compile the binary universally once), one for Intel Macs and the other for Mac >=10.3.9 running on PPC. Sharing resources is a non-issue.

I could put both MyProg_intel.app and MyProg_ppc.app into one zip and distribute it that way; but that may result in confusion for many people who I will be distributing my program to.

+1  A: 

In order to create a Universal Binary, you have to use Xcode and select both Intel and PPC target architectures. As far as I know, you can't just stuff two different binaries into one .app ex post facto.

Matt Ball
+1  A: 

Check out the man page for lipo. I believe you can use -create to take multiple input files and create a single output file with multiple architectures.

Nick Brosnahan
+3  A: 

See the lipo tool. It will let you stitch together your PPC and i386 binaries.

Also, sometimes separate targets for different architectures can be avoided by using conditional build settings in Xcode. This is useful if you need to link against a different binary library for each architecture, for example.

amrox
lipo looks like it could be my solution but the input_file is expecting a binary or some other type of file - not an .app (when I try it says _Can't map input file ((os/kern) invalid argument)_). My program is built with python and my packaging method does not compile every thing down into one binary, there are a large number of dependancies.
marshallpenguin
You use lipo to merge just the binaries: lipo myapp_ppc.app/Contents/MacOS/myapp -output myapp_i386.app/Contents/MacOS/myapp merges the PPC side into the Intel app, which you can then rename as a Universal app.But the other posters are more correct. You should create the app universal in the first place after building and linking each architecture, instead of doing the work of building the .app twice and throwing one away.
cdespinosa
py2app produces a universal binary already. Why not build your dependencies with "-arch i386 -arch ppc" in CFLAGS, CXXFLAGS and LDFLAGS?
Ivan Vučica
+1  A: 

Apple's developer web site has an article on Building an Open Source Universal Binary that explains how to use Xcode to 'package' a Universal Binary using build scripts. This is probably your best road to sanity. You could use lipo, but in the long run if you are going to update and maintain your application, having an Xcode project that does the magic for you is going to take up a lot less of your time.

peterb