Regression: xcodebuild no longer infers destination platform from -sdk parameter

Originator:google.j
Number:rdar://23973685 Date Originated:2015-12-22
Status:Duplicate/22993940 Resolved:
Product:Developer Tools Product Version:7.2/7C68 & 10.11.2/15C50
Classification: Reproducible:Always
 
Summary:
In Xcode 7.1.1 and earlier, passing -sdk iphonesimulator to xcodebuild would imply a suitable destination. In Xcode 7.2, this is no longer the case and the inferred destination is a generic iOS device rather than a simulator.

It is hard to imagine a case where this would be desired behaviour.

Steps to Reproduce:
1. Create a new iOS project with Xcode 7.1.1 or earlier.
2. With Xcode 7.1.1 or earlier selected through xcode-select or DEVELOPER_DIR, build it from the command line: xcodebuild -configuration Release -scheme <scheme> -sdk iphonesimulator clean build
3. Run the same build with Xcode 7.2

Expected Results:
The build should succeed in both cases.

Actual Results:
Xcodebuild infers a valid SDK root (iphonesimulator9.2) and sets -isysroot to -isysroot $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk. However, it selects architectures armv7 and arm64, and puts $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/usr/bin in $PATH.

This results in the compiler trying to use the simulator version of sys/cdefs.h to build with armv7 and arm64 architectures, which produces errors like:

In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include/sys/cdefs.h:707:2: error: Unsupported architecture
#error Unsupported architecture
 ^

Notes:
The attached archive contains:
* A sample project (just a Single View App template with the deployment target lowered to 9.0)
* A script to run test builds consistently and gather versioned logs
* Example output from Xcode 7.1.1 and 7.2.

Configuration:
Happens consistently in all tested configurations involving Xcode 7.2.

Comments

Looks like my https://openradar.appspot.com/24033506 is related.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!