64bit builds on OSX

I was asked to do 64bit builds for the mac of my app. I wanted to ask how to do that, there are 3 options, two universal binaries (32 and 64) but i guess this means it will be intel/ppc 32/64bit build. I was wondering if i can put 32/64 binaries into one binary (is that supported on the mac, a universal binary with two intel architectures). Maybe i need to create a new configuration “Release” with a 64-bit Intel option. Also i was wondering how 64bit Intel binaries are debugged if i boot into a normal 32bit kernel on the MAC, do i need to boot into a 64bit kernel to debug/test my 64bit apps?

It varies depending on which XCode you are using, but for 4.x you would select the top of your project tree, then select your target, then Build Options

Scroll down to “Architectures”. “Standard” is Intel 32 / 64 bit, that is, both 32 bit and 64 bit. You can still add other architectures, like PPC, provided that your deployment target is suitable (ppc is not supported in the latest SDKs).

To confirm what architectures are in your binary, you can use a built in command line tool called “file”. It will dump out what archs are in the binary.

To debug you have to run, and to run 64 bit code you have to be on a 64 bit OS-X. You also have to set the correct debug tools. Again, it varies from XCode version to XCode version, but on 4.x it is easiest to select the active “Scheme” (near the upper left corner of the window). Just pick “My Mac 64 bit” or “My Mac 32 bit”.

I’m trying not to go to Xcode 4 for as long as possible (i’m on the latest Xcode 3). Does any of the Introjucer options cause Xcode 3 to build a binary with both 32 and 64 bit archs for Intel only ?

No. You can do PPC/32, PPC/64, and just 64, but you’ll have to manually edit your project settings for a 32/64 bit intel binary.

Yes, you can do that, either by tuning your xcode configuration as stated by jfitzpat, or by using the “lipo” command line tool to assemble a “fat” binary with both intel architectures.
If your application opens VSTs, I would say it is better to keep two separate binaries in case your user wants to open his 32bits VSTs on a 64 machine.

Now, what I’m wondering right now, is if you still have to do universal binaries containing both architectures, or if newer versions of OSX are able to open the 64 version even on a 32 kernel? I think I read something like that somewhere but I can’t put my hand on it… does anybody have more information?

[quote=“Dri”]
Now, what I’m wondering right now, is if you still have to do universal binaries containing both architectures, or if newer versions of OSX are able to open the 64 version even on a 32 kernel? I think I read something like that somewhere but I can’t put my hand on it… does anybody have more information?[/quote]

I somewhat led astray above. A 32 bit kernel from Snow Leopard forward can load a 64 bit applications IF the underlying system can run 64 bit. That isn’t automatically true. So the norm on the app store is still to build 32/64 bit unless you are Lion (10.7) only. Lion only runs on 64 bit ready processors.

But my comment above is incorrect. You don’t have to be running the 64 bit kernel to debug 64 bit applications, but your machine must offer 64 bit support.