iOS-Framework icon indicating copy to clipboard operation
iOS-Framework copied to clipboard

Cannot build DependentApp with xcodebuild

Open schwa opened this issue 11 years ago • 4 comments

DependentApp project builds fine in Xcode. Does NOT build in xcodebuild.

Looks like any file that imports <Serenity/Serenity.h> will fail.

schwa@moth ~/D/i/s/DependentApp /master> xcodebuild -version Xcode 5.0.2 Build version 5A3005

Error:

Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>] Thread: <NSThread: 0x7fb7ee20ae90>{name = (null), num = 12} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. 2013-12-19 13:32:00.606 xcodebuild[10913:4307] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78 Details: Failed to load dependencies output contents from ``/Users/schwa/Desktop/iOS-Framework/sample/DependentApp/build/DependentApp.build/Release-iphoneos/DependentApp.build/Objects-normal/armv7/AppDelegate.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “AppDelegate.d” couldn’t be opened because there is no such file." UserInfo=0x7fb7ee209da0 {NSFilePath=/Users/schwa/Desktop/iOS-Framework/sample/DependentApp/build/DependentApp.build/Release-iphoneos/DependentApp.build/Objects-normal/armv7/AppDelegate.d, NSUnderlyingError=0x7fb7ebef6b90 "The operation couldn’t be completed. No such file or directory"}. User info: { NSFilePath = "/Users/schwa/Desktop/iOS-Framework/sample/DependentApp/build/DependentApp.build/Release-iphoneos/DependentApp.build/Objects-normal/armv7/AppDelegate.d"; NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 "The operation couldn\U2019t be completed. No such file or directory""; }.

schwa avatar Dec 19 '13 21:12 schwa

It's worth pointing out that Xcode these days is never building with targets, always schemes, even when you are using an xcodeproj file, it's using the scheme inside.

I haven't figured out why, but it seems that the workspace/scheme combo is resolving the search paths for the resulting framework/headers with no issues, the straight up target build does not.

xcodebuild still uses a project/target model if you give it no arguments. If the ultimate plan is to convince this to build from the command line, go modern and tell it to use the workspace. This goes off without a hitch: xcodebuild -workspace DependentApp.xcodeproj/project.xcworkspace -scheme DependentApp

jerryhjones avatar Dec 19 '13 22:12 jerryhjones

Ok, I spent a little more time trying to understand why the project/target build flow is broken, and it's like I thought, it's just a search path issue.

One of the annoying things about the old target build flow is that each subproject ends up creating its own build directory at its source root. When DependentApp builds the Serenity project, the resulting framework ends up sample/Serenity/build. We're really just talking about letting the compiler know about headers.

The following does work: xcodebuild FRAMEWORK_SEARCH_PATHS="../Serenity/build/Release-iphoneos/"

Unfortunately, things start to get a bit hairy here. We technically want to use a search path like ${SRCROOT}/../Serenity/build/${CONFIGURATION}-${PLATFORM_NAME}/. If the framework search paths were set in a build configuration, these environment values would resolve. Command builds require a bit more hoop jumping.

Suddenly, you start to see all the reasons why workspaces are generally more awesome than the old way.

jerryhjones avatar Dec 20 '13 00:12 jerryhjones

How much do I owe you?

Awesome stuff. Nice work.

schwa avatar Dec 20 '13 00:12 schwa

Hey jerry,

I am using xcodebuild -project ${WORKSPACE}/sample.xcodeproj -scheme dependentapp and i also clean build everytime i run this, but still i am facing this problem.

Pleas help. Thanks

sahil912 avatar Apr 05 '14 10:04 sahil912