views:

133

answers:

2

This may be a very silly question, but I'm new to developing on Macs and am having a hard time with the universal binaries.

I've got an application that I'm compiling in QT Creator, which according to lipo is producing i386 architecture outputs. As I understand it, that means it is producing Mac OS X 32 bit outputs.

The application depends on two external libraries. One of these libraries I'm compiling by calling ./config first, and then make. ./config states that it is "Configured for darwin-i386-cc". However, after running make, and calling lipo on the result, the architecture is reported as x86_64.

Similarly, I have another external library. That one has no configure script, and I compile it simply by calling make. The output from this one too is x86_64.

How can I compile these two external libraries so that they produce something compatible with my application's i386 output? Better yet, how can I compile these two external libraries to produce universal libraries so I can produce a universal binary from my application that works on both 32 and 64 bit?

Also, based on the current state of the Mac world, are there any other platforms that I should be expected to target to create a proper, user-friendly Mac OS X universal binary?

+1  A: 

I can't answer the main part of your question, because I always use Xcode rather than make. But as for that last part, if you support OS versions earlier than 10.6, you may need to compile for PowerPC (arch. code "ppc") as well.

JWWalker
Are PowerPC builds something that a significant portion of the Mac consumer market expects still?So a total of 3 platforms are expected for universal binaries?
Nantucket
I don't know what the percentage is, but I'm still supporting PowerPC, and I think many other products do. And I don't support 64 bits yet, because my product is partly Carbon. But if you're developing a new product now, it wouldn't be unreasonable to go Intel only. Consider your market: some segments, like education, may hang onto old hardware longer than others.
JWWalker
One more thing: as far as I know, the term "universal binary" usually means i386+ppc, not i386+x86_64.
JWWalker
nantucket: somewhere between 10 and 40% of Mac users have a PPC computer. However, I suspect that the number of PPCs used as "main machine" would be under 10%.
Coxy
+1  A: 

Finally got it working.

In order to control the architecture of the target, I manually went in and edited the Makefiles.

For one of them, I added to the end of the line that starts with CFLAGS: -arch i386 -arch x86_64 -arch ppc This produced a universal binary.

For the other, when I did the same thing, the compile would error out. I had to cycle through and only put one arch at a time, and then after I produced all three, I called lipo on them with the -create flag to create a universal binary.

Nantucket