So I would like to use xcodebuild in Terminal to create a build from a test application (called RunTeszt2). The app is an iOS single view application with nothing in it, just created and closed.
When I try this from the Terminal, the build fails.
xcodebuild -target "RunTeszt2" -sdk "$iphoneos5" -configuration Debug
The error is:
/Users/toodygarik/Desktop/RunTeszt2/RunTeszt2/RunTeszt2-Prefix.pch:12:13: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
The following build commands failed:
ProcessPCH /var/folders/6s/cjw35hhs5lb6wpnx9m8lr2km0000gn/C/com.apple.Xcode.501
/SharedPrecompiledHeaders/RunTeszt2-Prefix-bxwegbsdjylasccydwchfkbjadur/
RunTeszt2-Prefix.pch.pth RunTeszt2/RunTeszt2-Prefix.pch normal i386 objective-c
com.apple.compilers.llvm.clang.1_0.compiler
When I run the app from XCode (4.5), the build completes and everything is ok. I checked the console.app log when running the app from XCode and it does not display the error message above.
What is causing this issue?
EDIT: Based on H2CO3‘s comment, I edited the Other C Flags entry of the project’s Build Settings, like this:
-isysroot $SDKROOT
… and now that particular issue is solved. I’m back to my other xcodebuild related issue: iOS: XCode 4.4.1: xcodebuild error – Unable to read diagnostics from file
Thanks, H2CO3!
You have to specify the development sysroot of the particular OS you’re targetting, or else the compiler and linker cannot find the headers and libraries. Add
-isysroot <SYSROOT>to the compiler and linker flags, whereSYSROOTshould be the full path of theiPhoneOSXXX.sdkdirectory (XXX is the version number of iOS).