Xcode 7.2 fails to build iOS project on command line for simulator

Originator:neil.davis.yv
Number:rdar://23857648 Date Originated:11/12/2015
Status:Closed (Duplicate of 22993940) Resolved:
Product:Developer Tools Product Version:Xcode 7.2 (7C68)
Classification: Reproducible:Always
 
Summary:
xcodebuild fails to build a simple project on the command line. It seems there is a problem setting the platform variable. Some discussion here:
https://forums.developer.apple.com/thread/27975

Steps to Reproduce:
1. Create a new iOS 'Single View Application' called 'TestBuildCmd' from the project template in Xcode 7.2
2. In a terminal cd to the directory containing the project file (TestBuildCmd.xcodeproj)
3. Execute the following command to build on the command line:
xcodebuild -project TestBuildCmd.xcodeproj -scheme TestBuildCmd -sdk iphonesimulator clean build

Expected Results:
project builds and completes with "** BUILD SUCCEEDED **" output

Actual Results:
build fails. Lots of errors like this:
/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
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_dev_t;         /* dev_t */
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean 'uint32_t'?
typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */


Version:
Xcode 7.2 (7C68) / iOS 9.2 SDK
OS X 10.10.5

Notes:


Configuration:
MacBook Pro (Retina, 15-inch, Late 2013)
OS X 10.10.5

Attachments:

Comments

Alternative workaround without substituting xctool for xcodebuild: provide the -destination param to xcodebuild:

xcodebuild -project TestBuildCmd.xcodeproj -scheme TestBuildCmd -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' clean build

By neil.davis.yv at Dec. 15, 2015, 2:35 p.m. (reply...)

Workaround is to use xctool (https://github.com/facebook/xctool) which will successfully build using the same SDK

By neil.davis.yv at Dec. 11, 2015, 2:45 p.m. (reply...)

I have the same issue with xcodebuild on xcode 7.2 on MacBook Pro (Retina, 13-inch, Late 2011) / OS X 10.10.5


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!