Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Collect xcodebuild error in buildSettingsForATarget #295

Closed
dblock opened this issue Jan 15, 2014 · 10 comments
Closed

Collect xcodebuild error in buildSettingsForATarget #295

dblock opened this issue Jan 15, 2014 · 10 comments

Comments

@dblock
Copy link
Contributor

dblock commented Jan 15, 2014

Took me a while to figure this one out, trying to add a Travis-CI build to https://github.com/dblock/ios-snapshot-test-case-expecta.

Project build succeeds locally. Also succeeds on a different machine with a clean checkout.

Travis build fails with:

xctool -workspace FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo.xcworkspace -scheme FBSnapshotTestCaseDemo -configuration Debug clean
[Info] Loading settings for scheme 'FBSnapshotTestCaseDemo' ...2014-01-15 06:34:35.661 xctool[2048:2807] *** Assertion failure in -[XcodeSubjectInfo buildSettingsForATarget], /tmp/xctool-WSKd/xctool-0.1.14/xctool/xctool/XcodeSubjectInfo.m:813
2014-01-15 06:34:35.727 xctool[2048:2807] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed while trying to gather build settings for your scheme; tried with actions: build, test, analyze'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff98bbcb06 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff8fa7f3f0 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff98bbc948 +[NSException raise:format:arguments:] + 104
    3   Foundation                          0x00007fff979634c2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
    4   xctool                              0x00000001041b7ccf -[XcodeSubjectInfo buildSettingsForATarget] + 548
    5   xctool                              0x00000001041b89d1 -[XcodeSubjectInfo loadSubjectInfo] + 150
    6   xctool                              0x00000001041adbe4 -[Options validateAndReturnXcodeSubjectInfo:errorMessage:] + 2521
    7   xctool                              0x00000001041a5e67 -[XCTool run] + 1303
    8   xctool                              0x00000001041a50eb main + 507
    9   xctool                              0x00000001041a2f84 start + 52
    10  ???                                 0x0000000000000008 0x0 + 8
)
libc++abi.dylib: terminate called throwing an exception
make: *** [clean] Abort trap: 6

It says "Failed while trying to gather build settings for your scheme; tried with actions: build, test, analyze."

After some digging, added SHOW_ONLY_BUILD_SETTINGS_FOR_FIRST_BUILDABLE=YES DYLD_INSERT_LIBRARIES=/usr/local/Cellar/xctool/0.1.14/libexec/lib/xcodebuild-fastsettings-shim.dylib /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild test -showBuildSettings -project FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo.xcodeproj -scheme FBSnapshotTestCaseDemo to Travis and saw this:

xcodebuild: error: The project 'FBSnapshotTestCaseDemo' does not contain a scheme named 'FBSnapshotTestCaseDemo'.

This is the real problem, the schemes were not shared in the project, both of my machines have the same username, but Travis obviously has another.

The error above is what should be raised in https://github.com/facebook/xctool/blob/master/xctool/xctool/XcodeSubjectInfo.m#L764, probably means reading stderr.

@dblock
Copy link
Contributor Author

dblock commented Jan 15, 2014

Interestingly, the same version of XCTool, locally produces a proper error.

ERROR: Can't find scheme 'FBSnapshotTestCaseDemo'.

Possible schemes include:
   ...

Confused.

@revier
Copy link

revier commented Mar 10, 2014

Have you checked whether you ignore the scheme in .gitignore.
I met the same problem but fixed it after adding the scheme

@dblock
Copy link
Contributor Author

dblock commented Mar 10, 2014

@revier This isn't about fixing the issue, it's about xctool not displaying the error.

@voznesenskym
Copy link

Confirming in

https://travis-ci.org/clearkeep/CKDesktop

Is it inability in finding the scheme? why is the error not populating?

edit:

the build command for travis includes a script calling:

xctool -workspace "./Clear Keep/Clear Keep.xcworkspace" -scheme "Clear Keep" build test

When called locally, it works. When called on travis, it hangs.

@ghost
Copy link

ghost commented Aug 5, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

@dblock
Copy link
Contributor Author

dblock commented Aug 5, 2015

Thank you @facebook-github-bot-7!

@ExtremeMan
Copy link
Contributor

So the bug @dblock found is actually in xcodebuild which hangs when non-existing (read not available for a current user) scheme is passed. That is why we weren't populating any error. I've moved forward and changed the way xctool searches for schemes and then validates them. Now it will look only for a currently logged in user schemes (NSUserName().xcuserdatad) rather then for all user schemes. This will allows us to print error message when non-shared user scheme is used on the machine with a different username (before xcodebuild will hang). On the other hand it will still allow to use user scheme locally. Fixed on master in 728150d.

@dblock
Copy link
Contributor Author

dblock commented Aug 13, 2015

Thanks @ExtremeMan, glad this wasn't closed automagically.

@dblock
Copy link
Contributor Author

dblock commented Aug 13, 2015

@ExtremeMan I read the fix and I believe you fixed the issue that caused this to happen but not the fact that when something like this happens there's no error. Xcode will hang if no schemes are found I think, but I haven't confirmed.

@ExtremeMan
Copy link
Contributor

@dblock, right, Xcode will hang, but we will not call to xcodebuild and catch the error here: https://github.com/facebook/xctool/blob/master/xctool/xctool/Options.m#L490-L512.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants