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

Xcode 8 beta fails to build #704

Closed
cezheng opened this issue Jul 4, 2016 · 64 comments
Closed

Xcode 8 beta fails to build #704

cezheng opened this issue Jul 4, 2016 · 64 comments

Comments

@cezheng
Copy link

cezheng commented Jul 4, 2016

I have a swift project that runs tests on travis-ci, and once I created the swift 3 branch and tried to run the tests it failed on an assertion. The tests themselves are fine since I have successfully run them locally.

=== TEST ===

  xcodebuild build build

2016-07-04 13:15:12.969 xctool[1420:4193] *** Assertion failure in __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke(), /tmp/xctool20160411-73857-17y7ykv/xctool-0.2.9/Common/XCToolUtil.m:380

2016-07-04 13:15:13.012 xctool[1420:4193] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Got error while trying to deserialize event 'User defaults from command line:': The data is not in the correct format.'

*** First throw call stack:

(

    0   CoreFoundation                      0x00007fff813f24f2 __exceptionPreprocess + 178

    1   libobjc.A.dylib                     0x00007fff80e1473c objc_exception_throw + 48

    2   CoreFoundation                      0x00007fff813f71ca +[NSException raise:format:arguments:] + 106

    3   Foundation                          0x00007fff8e9001ee -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169

    4   xctool                              0x0000000107bf78c4 __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke + 441

    5   xctool                              0x0000000107c32c39 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke + 165

    6   xctool                              0x0000000107c32f42 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke.26 + 612

    7   xctool                              0x0000000107c330ae __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke_2.49 + 188

    8   libdispatch.dylib                   0x00007fff8b494c0b ___dispatch_operation_deliver_data_block_invoke + 118

    9   libdispatch.dylib                   0x00007fff8b47f93d _dispatch_call_block_and_release + 12

    10  libdispatch.dylib                   0x00007fff8b47440b _dispatch_client_callout + 8

    11  libdispatch.dylib                   0x00007fff8b47903b _dispatch_queue_drain + 754

    12  libdispatch.dylib                   0x00007fff8b47f707 _dispatch_queue_invoke + 549

    13  libdispatch.dylib                   0x00007fff8b479200 _dispatch_queue_drain + 1207

    14  libdispatch.dylib                   0x00007fff8b47f707 _dispatch_queue_invoke + 549

    15  libdispatch.dylib                   0x00007fff8b477d53 _dispatch_root_queue_drain + 538

    16  libdispatch.dylib                   0x00007fff8b477b00 _dispatch_worker_thread3 + 91

    17  libsystem_pthread.dylib             0x00007fff837ba4de _pthread_wqthread + 1129

    18  libsystem_pthread.dylib             0x00007fff837b8341 start_wqthread + 13

)

libc++abi.dylib: terminating with uncaught exception of type NSException

/Users/travis/build.sh: line 45:  1420 Abort trap: 6           xctool -works

https://travis-ci.org/cezheng/Fuzi/builds/140457732

@connork26
Copy link

Getting the same error in an objective-c framework. Works fine with xcode 7.3.1, but once I switch to 8 I get this:

2016-07-05 16:33:54.656 xctool[30021:574484] *** Assertion failure in __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke(), /Users/nekto/Projects/xctool/Common/XCToolUtil.m:380
2016-07-05 16:33:54.657 xctool[30021:574484] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Got error while trying to deserialize event 'Build settings from command line:': The data is not in the correct format.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff9a0324f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff95505f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9a0371ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9d3d01ee -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169
    4   xctool                              0x000000010a9ada24 __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke + 441
    5   xctool                              0x000000010a9e8d99 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke + 165
    6   xctool                              0x000000010a9e90a2 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke.26 + 612
    7   xctool                              0x000000010a9e920e __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke_2.49 + 188
    8   libdispatch.dylib                   0x00007fff8a0f7c0b ___dispatch_operation_deliver_data_block_invoke + 118
    9   libdispatch.dylib                   0x00007fff8a0e293d _dispatch_call_block_and_release + 12
    10  libdispatch.dylib                   0x00007fff8a0d740b _dispatch_client_callout + 8
    11  libdispatch.dylib                   0x00007fff8a0dc03b _dispatch_queue_drain + 754
    12  libdispatch.dylib                   0x00007fff8a0e2707 _dispatch_queue_invoke + 549
    13  libdispatch.dylib                   0x00007fff8a0dc200 _dispatch_queue_drain + 1207
    14  libdispatch.dylib                   0x00007fff8a0e2707 _dispatch_queue_invoke + 549
    15  libdispatch.dylib                   0x00007fff8a0dad53 _dispatch_root_queue_drain + 538
    16  libdispatch.dylib                   0x00007fff8a0dab00 _dispatch_worker_thread3 + 91
    17  libsystem_pthread.dylib             0x00007fff920f64de _pthread_wqthread + 1129
    18  libsystem_pthread.dylib             0x00007fff920f4341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException```

@jakjothi
Copy link

I am getting no response travis build fails after 10 mins
Environment: osx
Target: 10.11
Command: xctool -scheme myappscheme -workspace myapp.xcworkspace

This worked xcode 7.3.1

@emaloney
Copy link

Looks like xctool is not compatible with Xcode 8. I am hitting the same problem:

=== CLEAN ===

  xcodebuild clean CleanroomASL-iOS
2016-07-20 12:47:40.937 xctool[31294:843518] *** Assertion failure in __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke(), /tmp/xctool/Common/XCToolUtil.m:380
2016-07-20 12:47:40.940 xctool[31294:843518] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Got error while trying to deserialize event '=== CLEAN TARGET CleanroomASL-iOS OF PROJECT CleanroomASL WITH CONFIGURATION Debug ===': The data is not in the correct format.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff948bb4f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff9888c73c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff948c01ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff8be251ee -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169
    4   xctool                              0x0000000100de282b __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke + 683
    5   xctool                              0x0000000100e6ab7b __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke + 107
    6   xctool                              0x0000000100e6af54 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke.26 + 436
    7   xctool                              0x0000000100e6b4c3 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke_2.49 + 435
    8   libdispatch.dylib                   0x00007fff8c94bc0b ___dispatch_operation_deliver_data_block_invoke + 118
    9   libdispatch.dylib                   0x00007fff8c93693d _dispatch_call_block_and_release + 12
    10  libdispatch.dylib                   0x00007fff8c92b40b _dispatch_client_callout + 8
    11  libdispatch.dylib                   0x00007fff8c93003b _dispatch_queue_drain + 754
    12  libdispatch.dylib                   0x00007fff8c936707 _dispatch_queue_invoke + 549
    13  libdispatch.dylib                   0x00007fff8c930200 _dispatch_queue_drain + 1207
    14  libdispatch.dylib                   0x00007fff8c936707 _dispatch_queue_invoke + 549
    15  libdispatch.dylib                   0x00007fff8c92ed53 _dispatch_root_queue_drain + 538
    16  libdispatch.dylib                   0x00007fff8c92eb00 _dispatch_worker_thread3 + 91
    17  libsystem_pthread.dylib             0x00007fff97de54de _pthread_wqthread + 1129
    18  libsystem_pthread.dylib             0x00007fff97de3341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Abort trap: 6

emaloney pushed a commit to emaloney/CleanroomText that referenced this issue Jul 20, 2016
xctool isn't yet compatible with Xcode 8:

facebookarchive/xctool#704
@ExtremeMan
Copy link
Contributor

Unfortunately Facebook doesn't have any plans to support xctool in Xcode 8. I will keep you updated if something changes. Sorry, folks.

@cezheng
Copy link
Author

cezheng commented Jul 21, 2016

@ExtremeMan

Unfortunately Facebook doesn't have any plans to support xctool in Xcode 8.

Does this mean just right now or even after Xcode 8.0's final release? If latter, is this project somewhat deprecated & we should look for something else to run the tests?

@ExtremeMan
Copy link
Contributor

Does this mean just right now or even after Xcode 8.0's final release?

We haven't decided yet but it would be safer for you to look for something else. May be we will ship Buck with some simple test utility or extend FBSimulatorControl.

I am here though if our community wants to actively work on xctool and support future releases of Xcode.

@cezheng
Copy link
Author

cezheng commented Jul 21, 2016

@ExtremeMan Does this mean that facebook is not internally using xctool for running Xcode tests anymore?

@ExtremeMan
Copy link
Contributor

@cezheng we use it for Xcode 7 builds.

@cezheng
Copy link
Author

cezheng commented Jul 21, 2016

@ExtremeMan Thanks for the information. Wish facebook will ship an even better tool for Xcode 8 then:)

@emaloney
Copy link

Thanks for the heads-up, @ExtremeMan. That's too bad, but I appreciate the work that went into it and the opportunity to use it for free all these years. Might I suggest updating the README to mention that xctool will no longer be supported as of Xcode 8? If you'd like a pull request for that, I'd be happy to do it.

@ExtremeMan
Copy link
Contributor

@emaloney, I will update README as soon as we are sure we deprecate it. Also we will move it to Facebook archives if so is decided.

@lawrencelomax
Copy link

To clear up the error message that you're seeing here, in Xcode 8 added "Increased Xcode.app security due to runtime library validation".

What's happening with xctool is that the shims that xctool injects into the xcodebuild process is prevented from being loaded at runtime. xctool relies on these shims in order to do its magic. You can see this in the syslog in this gist, or by running syslog | grep deny | grep xctool

@ExtremeMan
Copy link
Contributor

There is still a way to workaround added Xcode restrictions by resigning it. People are going to that to run Xcode plugins and I would expect CI system to do that as well in order to continue using such tools as xctool in future until Apple's own tools are good enough for them.

@plu
Copy link
Contributor

plu commented Jul 26, 2016

@ExtremeMan Can you please give some more details on how that resigning would work? That sounds interesting!

@ExtremeMan
Copy link
Contributor

I found all the details here: alcatraz/Alcatraz#475. But I haven't tried myself.

@plu
Copy link
Contributor

plu commented Jul 26, 2016

Thank you!

@oliverhu
Copy link

I have some good news to share :)

All you need to make xctool work again is use https://github.com/steakknife/unsign to unsign the XCTest binary in /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework

Then xctool just works @plu @ExtremeMan

@ExtremeMan
Copy link
Contributor

@oliverhu without any patches to the tool? What about application tests?

@oliverhu
Copy link

@ExtremeMan it seems you just need to wipe out all the signatures around all dependent dylib/binaries. I also wiped xcodebuild.

Prior to wiping:


khu@khu-mn1:~/ios/mntf-ios_trunk (master)$ /Users/khu/ios/dev/voyager-ios_trunk/build/xctool/bin/xctool -scheme mntf-iosSampleApp -workspace mntf-ios.xcworkspace/ run-tests
[Info] Loading settings for scheme 'mntf-iosSampleApp' ...2016-07-30 00:24:04.217 xctool[31271:341530] *** Assertion failure in -[XcodeSubjectInfo buildSettingsForATarget], /export/home/tester/hudson/data/workspace/MP_TRUNKDEV_POSTCOMMIT/li-xctool_6d91edca1256f2d73a4e6ed7f0b0646e323ea064/xctool/src/xctool/xctool/xctool/XcodeSubjectInfo.m:839

2016-07-30 00:24:04.350 xctool[31271:341530] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed while trying to gather build settings for your scheme; tried with actions: build, test, analyze. Errors above occured while running xcodebuild -showBuildSettings:
  dyld: warning: could not load inserted library '/Users/khu/ios/dev/voyager-ios_trunk/build/xctool/lib/xcodebuild-fastsettings-shim.dylib' into library validated process because no suitable image found.  Did find:
    /Users/khu/ios/dev/voyager-ios_trunk/build/xctool/lib/xcodebuild-fastsettings-shim.dylib: cannot load image with wrong team ID in process using Library Validation
dyld: Library not loaded: @rpath/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core
  Referenced from: /Applications/Xcode-beta.app/Contents/Developer/usr/bin/xcodebuild
  Reason: no suitable image found.  Did find:
    /Applications/Xcode-beta.app/Contents/Developer/usr/bin/../../../PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core: mmap() error 1 at address=0x107831000, size=0x0007E000 segment=__TEXT in Segment::map() mapping /Applications/Xcode-beta.app/Contents/Developer/usr/bin/../../../PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core
.
  dyld: warning: could not load inserted library '/Users/khu/ios/dev/voyager-ios_trunk/build/xctool/lib/xcodebuild-fastsettings-shim.dylib' into library validated process because no suitable image found.  Did find:
    /Users/khu/ios/dev/voyager-ios_trunk/build/xctool/lib/xcodebuild-fastsettings-shim.dylib: cannot load image with wrong team ID in process using Library Validation
dyld: Library not loaded: @rpath/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core
  Referenced from: /Applications/Xcode-beta.app/Contents/Developer/usr/bin/xcodebuild
  Reason: no suitable image found.  Did find:
    /Applications/Xcode-beta.app/Contents/Developer/usr/bin/../../../PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core: mmap() error 1 at address=0x11113C000, size=0x0007E000 segment=__TEXT in Segment::map() mapping /Applications/Xcode-beta.app/Contents/Developer/usr/bin/../../../PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core
.
  dyld: warning: could not load inserted library '/Users/khu/ios/dev/voyager-ios_trunk/build/xctool/lib/xcodebuild-fastsettings-shim.dylib' into library validated process because no suitable image found.  Did find:
    /Users/khu/ios/dev/voyager-ios_trunk/build/xctool/lib/xcodebuild-fastsettings-shim.dylib: cannot load image with wrong team ID in process using Library Validation
dyld: Library not loaded: @rpath/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core
  Referenced from: /Applications/Xcode-beta.app/Contents/Developer/usr/bin/xcodebuild
  Reason: no suitable image found.  Did find:
    /Applications/Xcode-beta.app/Contents/Developer/usr/bin/../../../PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core: mmap() error 1 at address=0x103853000, size=0x0007E000 segment=__TEXT in Segment::map() mapping /Applications/Xcode-beta.app/Contents/Developer/usr/bin/../../../PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core.

*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff969fd4f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff8ca71f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff96a021ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9bc5e856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   xctool                              0x000000010c1f7754 -[XcodeSubjectInfo buildSettingsForATarget] + 955
    5   xctool                              0x000000010c1f86f9 -[XcodeSubjectInfo loadSubjectInfo] + 551
    6   xctool                              0x000000010c1e4aed -[Options validateAndReturnXcodeSubjectInfo:errorMessage:] + 3489
    7   xctool                              0x000000010c1d6780 -[XCTool run] + 2292
    8   xctool                              0x000000010c1d5497 main + 1064
    9   xctool                              0x000000010c1d0844 start + 52
    10  ???                                 0x0000000000000006 0x0 + 6
)
libc++abi.dylib: terminating with uncaught exception of type NSException

After wiping, all warnings are gone, however, I was celebrating too early, not fully working yet, now I get:


[Info] Loading settings for scheme 'mntf-iosSampleApp' ... (956 ms)

=== RUN-TESTS ===

  [Info] Collecting info for testables...2016-07-30 00:26:10.632 xctool[31341:343843] *** Assertion failure in -[SimulatorInfo systemRootForSimulatedSdk], /export/home/tester/hudson/data/workspace/MP_TRUNKDEV_POSTCOMMIT/li-xctool_6d91edca1256f2d73a4e6ed7f0b0646e323ea064/xctool/src/xctool/xctool/xctool/SimulatorWrapper/SimulatorInfo.m:283
2016-07-30 00:26:10.633 xctool[31341:343843] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to instantiate DTiPhoneSimulatorSystemRoot for platform iphonesimulator and sdk version 10.0. Available roots: (null)'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff969fd4f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff8ca71f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff96a021ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9bc5e856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   xctool                              0x0000000106b27414 -[SimulatorInfo systemRootForSimulatedSdk] + 685
    5   xctool                              0x0000000106b2749c -[SimulatorInfo simulatedRuntime] + 63
    6   xctool                              0x0000000106b2768a -[SimulatorInfo simulatedDevice] + 76
    7   xctool                              0x0000000106b066fb CreateTaskForSimulatorExecutable + 267
    8   xctool                              0x0000000106b252a5 -[OCUnitIOSAppTestQueryRunner createTaskForQuery] + 441
    9   xctool                              0x0000000106b1234c -[OCUnitTestQueryRunner runQueryWithError:] + 361
    10  xctool                              0x0000000106b42b0f +[TestableExecutionInfo queryTestCasesWithSimulatorInfo:error:] + 411
    11  xctool                              0x0000000106b4209e +[TestableExecutionInfo infoForTestable:buildSettings:simulatorInfo:] + 304
    12  xctool                              0x0000000106b18cb2 __56-[RunTestsAction runTestables:options:xcodeSubjectInfo:]_block_invoke + 883
    13  libdispatch.dylib                   0x00007fff8dfe693d _dispatch_call_block_and_release + 12
    14  libdispatch.dylib                   0x00007fff8dfdb40b _dispatch_client_callout + 8
    15  libdispatch.dylib                   0x00007fff8dfe003b _dispatch_queue_drain + 754
    16  libdispatch.dylib                   0x00007fff8dfe6707 _dispatch_queue_invoke + 549
    17  libdispatch.dylib                   0x00007fff8dfdb40b _dispatch_client_callout + 8
    18  libdispatch.dylib                   0x00007fff8dfdf29b _dispatch_root_queue_drain + 1890
    19  libdispatch.dylib                   0x00007fff8dfdeb00 _dispatch_worker_thread3 + 91
    20  libsystem_pthread.dylib             0x00007fffa11384de _pthread_wqthread + 1129
    21  libsystem_pthread.dylib             0x00007fffa1136341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Abort trap: 6

@ExtremeMan
Copy link
Contributor

ExtremeMan commented Jul 30, 2016

Last one looks fine because it is at least xctool failing, not Xcode tools. Thanks for the info. Probably it is worth investigating further.

@oliverhu
Copy link

Did a bit more research today, was able to launch simulators by removing DTiPhoneSimulatorSystemRoot from dependencies (DTiPhoneSimulatorSystemRoot class is removed in the new SDK :\ by dumping the DTFramework)

Got some new errors this time, seems Apple did learn from the Malicious Xcode incident:


[Info] Loading settings for scheme 'mntf-iosSampleApp' ... (1034 ms)

=== RUN-TESTS ===

  [Info] Collecting info for testables... (2244 ms)
  run-test mntf-iosSampleAppTests.xctest (iphonesimulator10.0, iPhone 6, application-test)
    [Info] Prepared 'iPhone 6' simulator to run tests. (9 ms)
    [Info] Installed 'mntf-iosSampleApp'. (3606 ms)
    [Info] Launched 'mntf-iosSampleApp' on 'iPhone 6'. (29 ms)
      -[FAILED_BEFORE TESTS_RAN]
Test did not run: the test bundle stopped running or crashed before the test suite started.

dyld: lazy symbol binding failed: Symbol not found: _dyld_register_image_state_change_handler
  Referenced from: /Users/khu/Library/Developer/Xcode/DerivedData/xctool-bluwzellguehrdcexzwvuwhdwwil/Build/Products/Debug/lib/otest-shim-ios.dylib
  Expected in: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.dylib

dyld: Symbol not found: _dyld_register_image_state_change_handler
  Referenced from: /Users/khu/Library/Developer/Xcode/DerivedData/xctool-bluwzellguehrdcexzwvuwhdwwil/Build/Products/Debug/lib/otest-shim-ios.dylib
  Expected in: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.dylib

After disassembling the dyld_sim binary, I found the method dyld_register_image_state_change_handler is not there anymore and we are not able to know when the image is loaded :(

I guess even if after I have fixed this, something else will pop up... here is my understanding of the shim.dylib, correct me if wrong:

  • We found some bugs in SenTest framework and wanted to fix them
  • We wanted to add some additional logging during tests (headers/footers)
  • The easiest way to inject code is by appending another dylib
  • We can only swizzle a method when the dylib is loaded
  • The SenTest/xx frameworks are loaded in the hosting app (testing bundle), on which xctool is not able to know easily whether the corresponding lib is loaded or not.

To resolve all these hassle, is that possible that instead of injecting dylibs, we tackle this by IPC with the app, for example, when XCTest is loaded in the app, we sent a distributed_notification/xpc message out and then we swizzle in the xctool side? @ExtremeMan

@ExtremeMan
Copy link
Contributor

I guess #707 helps to solve the latest issue you hit, @oliverhu?

@oliverhu
Copy link

oliverhu commented Aug 4, 2016

Yah, I used _dyld_register_func_for_add_image to solve that problem and #707 is also a good fix :D I made it to run tests in simulators but the test report is still broken. I'll take some time this weekend to hack more.

@cegonya
Copy link

cegonya commented Oct 4, 2016

I'm using xctool 0.2.10 (from master) and Xcode 8.1 Beta 1 and got this error:

2016-10-04 18:50:31.047 xctool[5019:1134172] +[SimDeviceType supportedDeviceTypesByAlias]: unrecognized selector sent to class 0x10866ffe0
2016-10-04 18:50:31.180 xctool[5019:1134172] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SimDeviceType supportedDeviceTypesByAlias]: unrecognized selector sent to class 0x10866ffe0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff910d44f2 exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8922ef7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff9113e0ad +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff91044571 __forwarding
+ 1009
4 CoreFoundation 0x00007fff910440f8 _CF_forwarding_prep_0 + 120
5 xctool 0x0000000107d63e18 +[SimulatorInfo deviceNameForAlias:] + 58
6 xctool 0x0000000107d49122 -[Options _validateDestinationWithErrorMessage:] + 365
7 xctool 0x0000000107d47b6c -[Options validateAndReturnXcodeSubjectInfo:errorMessage:] + 104
8 xctool 0x0000000107d394ca -[XCTool run] + 2858
9 xctool 0x0000000107d37ebd main + 1151
10 xctool 0x0000000107d328f4 start + 52
11 ??? 0x0000000000000009 0x0 + 9
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

using this command:

xctool -configuration Test -destination 'platform=iOS Simulator,OS=10.1,name=iPhone 7' -showTasks test OBJROOT=./Build

anyone with the same problem?

SSheldon added a commit to Yelp/yelp-ios that referenced this issue Oct 15, 2016
Also switch from xctool to xcodebuild since xctool isn't supported on
Xcode 8: facebookarchive/xctool#704.
SSheldon added a commit to Yelp/yelp-ios that referenced this issue Oct 15, 2016
Also switch from xctool to xcodebuild since xctool isn't supported on
Xcode 8: facebookarchive/xctool#704.
@aaronclarke
Copy link

aaronclarke commented Oct 17, 2016

@cegonya I've seen similar with our own projects, also on 0.2.10 and Xcode 8.1 beta 3.

I'm new to reverse engineering Xcode frameworks, but from my debugging with otool -ov /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/CoreSimulator it looks like a lot of functionality related to getting all devicetypes / runtimes / devices has moved from their respective classes to being accessible from an instance of "SimServiceContext"

Where before there was:

-[SimDeviceType supportedDeviceTypesByAlias]
+[SimDeviceSet defaultSet]
+[SimRuntime supportedRuntimes]

There is now:

-[SimServiceContext supportedDeviceTypesByAlias]
-[SimServiceContext defaultDeviceSetWithError:]
-[SimServiceContext supportedRuntimes]

The class can be initialized with something like this:
[SimServiceContext sharedServiceContextForDeveloperDir:XcodeDeveloperDir() error:nil]

qmathe added a commit to qmathe/DropDownMenuKit that referenced this issue Oct 17, 2016
Note: xctool is currently incompatible with Xcode 8. See facebookarchive/xctool#704
SpacyRicochet added a commit to SpacyRicochet/CocoaHeadsNL-iOS that referenced this issue Oct 22, 2016
xctool doesn’t support building anymore since Xcode 8. See facebookarchive/xctool#704 for details.
@ExtremeMan
Copy link
Contributor

xctool doesn't support building for Xcode 8 and later. Please, update to xcodebuild or other build tools. xctool will still support running tests.

0.3 release is pending approval and should be soon available via homebrew.

@haithngnbak
Copy link

haithngnbak commented Dec 10, 2016

I have updated xctool to version 0.3.1 via homebrew, xcode 8.1 final
Currently, I cannot make the build with xctool, the terminal app said:

ERROR: Unexpected action: clean
[Info] Loading settings for scheme 'MyApp' ... (3675 ms)

=== BUILD ===

  xcodebuild build MyApp
2016-12-10 23:02:05.132 xctool[44393:450979] *** Assertion failure in __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke(), /tmp/xctool-20161113-10169-11qccdv/xctool-0.3.1/Common/XCToolUtil.m:395
2016-12-10 23:02:05.136 xctool[44393:450979] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Got error while trying to deserialize event 'Build settings from command line:': The data is not in the correct format.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff9b368452 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff8ca6d73c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff9b36d12a +[NSException raise:format:arguments:] + 106
	3   Foundation                          0x00007fff867351ee -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169
	4   xctool                              0x00000001067bba9d __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke + 436
	5   xctool                              0x00000001067f9fed __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke + 165
	6   xctool                              0x00000001067fa339 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke.26 + 679
	7   xctool                              0x00000001067fa4a4 __ReadOutputsAndFeedOuputLinesToBlockOnQueue_block_invoke_2.49 + 188
	8   libdispatch.dylib                   0x00007fff891a2c0b ___dispatch_operation_deliver_data_block_invoke + 118
	9   libdispatch.dylib                   0x00007fff8918d93d _dispatch_call_block_and_release + 12
	10  libdispatch.dylib                   0x00007fff8918240b _dispatch_client_callout + 8
	11  libdispatch.dylib                   0x00007fff8918703b _dispatch_queue_drain + 754
	12  libdispatch.dylib                   0x00007fff8918d707 _dispatch_queue_invoke + 549
	13  libdispatch.dylib                   0x00007fff89187200 _dispatch_queue_drain + 1207
	14  libdispatch.dylib                   0x00007fff8918d707 _dispatch_queue_invoke + 549
	15  libdispatch.dylib                   0x00007fff89185d53 _dispatch_root_queue_drain + 538
	16  libdispatch.dylib                   0x00007fff89185b00 _dispatch_worker_thread3 + 91
	17  libsystem_pthread.dylib             0x00007fff9b7424de _pthread_wqthread + 1129
	18  libsystem_pthread.dylib             0x00007fff9b740341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

./build.sh: line 27: 44393 Abort trap: 6           xctool -sdk "$sdk" -scheme "$scheme" -configuration "$configuration" OBJROOT="$PWD/build" SYMROOT="$PWD/build" ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="$identity"



warning: PackageApplication is deprecated, use `xcodebuild -exportArchive` instead.



error: Specified application doesn't exist or isn't a bundle directory 

There is my command line : that worked well in xcode 7
./build.sh 'Release' '0.3.0' '1'

Script Build:

crashlytics_api_key=xxxxzzz
crashlytics_build_secret=xxxzzz

configuration='Release'
provision="MyApp_Ad_Hoc.mobileprovision"
identity="iPhone Distribution: Hai (9N7V3ZZZZ)"

sdk="iphoneos"
scheme="AirYes"
configuration=$1
version=$2
build=$3
output="$PWD/build/$scheme.$version.$build.$configuration.ipa"

PLIST_PATH="./MyApp/Application"
PLIST_FILE="Info.plist"

/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $version" "$PLIST_PATH/$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version.$build" "$PLIST_PATH/$PLIST_FILE"

echo "Cleaning up old build..."
rm -Rf "$PWD/build/$configuration-$sdk"

echo "Building $scheme, using $configuration configuration, provisioning = $provision"
xctool -sdk "$sdk" -scheme "$scheme" -configuration "$configuration" clean OBJROOT="$PWD/build" SYMROOT="$PWD/build" ONLY_ACTIVE_ARCH=NO
xctool -sdk "$sdk" -scheme "$scheme" -configuration "$configuration" OBJROOT="$PWD/build" SYMROOT="$PWD/build" ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="$identity"
xcrun -sdk "$sdk" PackageApplication -v "$PWD/build/$configuration-$sdk/$scheme.app" -o "$PWD/build/$configuration-$sdk/$scheme.ipa" --embed "$provision"

cp "$PWD/build/$configuration-$sdk/$scheme.ipa" "$output"

echo "Uploading $output to Fabric.io..."
echo "./Crashlytics.framework/submit $crashlytics_api_key $crashlytics_build_secret -ipaPath ""$output"""
./Crashlytics.framework/submit $crashlytics_api_key $crashlytics_build_secret -ipaPath "$output"

@ExtremeMan
Copy link
Contributor

xctool now supports only running tests. Replace in your script xctool with xcodebuild and should just work with Xcode 8.

@fabb
Copy link

fabb commented Dec 11, 2016

Or even better xcodebuild + xcpretty for nicer output https://github.com/supermarin/xcpretty
Or use gym from fastlane if you want to build ipas. Or xcbuild.

@LavrL
Copy link

LavrL commented Dec 30, 2016

@ExtremeMan when I change xctool to xcodebuild - I have error "xcodebuild: error: invalid option '-reporter'"

@fabb
Copy link

fabb commented Dec 30, 2016

@LavrL pipe to xcpretty for that

@LavrL
Copy link

LavrL commented Dec 30, 2016

@fabb any other solution ?

@fabb
Copy link

fabb commented Dec 30, 2016

@LavrL oops, i meant xcpretty, not xctool.

thii added a commit to thii/SwiftHEXColors that referenced this issue Jan 6, 2017
* Swift 3.0

* Indention

* Replaced travis xctool with xcodebuild

See facebookarchive/xctool#704

* Travis build check
@guoyingtao
Copy link

Still met the same problem. Is this issue closed?

@alvincrisuy
Copy link

@guoyingtao yes

follow what @ExtremeMan said replacing xctool with xcodebuild

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