On Mar 1, 2008, at 12:42 PM, Terry Simons wrote: I'm playing around with Xcode trying to port an existing project to Xcode.
I created a target and pulled up the info pane, and I'm really confused about the "Architectures" item in the "Architectures" section at the top of the pane.
When double-clicking on the "Architectures" item, I get the option to select both 32-bit and 64-bit architectures. 32-bit is selected by default and the value is i386. When I also select 64-bit, the architectures the value changes to x86_64, which seems counter intuitive. I expect both items to be listed (i.e. i386 x86_64) just like they are listed in the "Valid Architectures" list below.
I can *sometimes* get this to occur the way I expect by re-opening it, unchecking and rechecking x86_64.
Here are some steps that appear to consistently reproduce the odd behavior:
* Uncheck all architectures. The architecture will default back to 32-bit (i386). * Double-click to open the "Architectures to build for" sheet. * Note that 32-bit is selected. Also select 64-bit and click "OK". * The Architectures list changes to x86_64. (I expected i386 and x86_64) * Re-open the sheet again. * Unselect x86_64 and re-select it without leaving the sheet, then click "OK" again. * The Architectures list changes to the expected i386 and x86_64.
Is this a known bug?
No, that is working as designed, but the design is confusing and has places where it's not especially useful.
The 32- and 64-bit checkboxes represent two different things, depending on what the underlying value of the build setting is. (You can see the underlying value by selecting Architectures and pressing Tab, or command-clicking and choosing "Show Property Assignments" from the context menu.)
If the Architectures is one or more literal architecture values (like ppc, i386, x86_64, or ppc64) the check boxes set those to pairs of literal values: "ppc i386" for 32-bit, "ppc64 x86_64" for 64-bit, and all four if both are checked. These values are conventional in and appropriate for Release configurations.
If the Architectures value is a predefined build setting (like $(NATIVE_ARCH)), the check boxes set the value of Architectures to other predefined build settings, which in turn expand to appropriate single values. For example, checking 64-bit sets it to $(NATIVE_ARCH_64_BIT), which expands to "ppc64" on a G5 and "x86_64" on a Core Duo. These ensure that your code builds for a single correct architecture on any build machine, and is appropriate for Debug configurations.
The system is designed that if you start with literal architectures, you always get literal architectures and build for multiple platforms; but if you start with a predefined build setting you always get predefined build settings. With one dxception: if you uncheck them both it drops into the Predefined Build Setting circuit. Which is what you're seeing.
The solution is to select the Architectures line, press Tab, and enter the archs you want, either literal or build setting-based.
The next version of Xcode has a completely redesigned Architectures UI and this problem is eliminated.
Chris |