tags:

views:

15

answers:

1

I'm building a lib for iPhone SDK use using the SDK, and I use Makefiles, not xcode.

Consider this command line (or at least the beginning of a compile command line).

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 -arch armv6 -pipe -no-cpp-precomp -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk

I thought to add -arch i386 to the command line, but that doesn't work, since the iPhone platform does not include the simulator headers, and vica versa. I know that there's a means with lipo to combine them after the fact, but that doesn't fit very cleanly into my situation. Is there a mechanism I'm missing, other than manually creating a merged platform directory?

+1  A: 

As far as I know, you can't compile separate architectures from separate SDKs in one fell swoop.

I could be wrong, and I'd be happy to be corrected, but I think the only way is to compile it twice, once for arm6/7 and once for i386 and then lipo the two resulting libraries.

Jasarien
Pity. It works fine for universal MacOS binaries.
bmargulies
Well, perhaps I'm wrong, and it is possible and I simply don't know about it? :) I'm sure someone with more knowledge than me will be able to confirm or deny this outright.
Jasarien
I think that you are right, but I'm not accepting until we give it a bit more time.
bmargulies
Sounds fair to me. It might work on OS X because PPC and Intel SDKs contain the same headers and are functionally identical. The iPhone platform and the simulator platform aren't quite functionally identical.
Jasarien