Compilation failures with actool and ibtoold after xcode-select

On our Continuous Integration we use `sudo xcode-select` to switch Xcode versions frequently. Historically, we've had issues like this with `actool` during compilation:


```

Build failed: Command failed with exit code 255. stderr: When running <actool>. When building rule //libraries/foo/Foo#apple-asset-catalog,apple-test-bundle,dwarf,no-linkermap.

```


(the error comes from buck but the important part is that `actool` returns an exit code of 255).


We've fixed this in the past by killing `CoreSimulatorService` after switching Xcode. This is because for some reason, `actool` needs to communicate with the simulator (maybe over XPC?) and if you've recently switched Xcode versions, you might need to kill `CoreSimulatorService` before it will start working correctly.


However this year with Xcode 10, the issue has surfaced again.


The only fix I could find was converting the asset catalog that it was trying to compile to just normal PNG files. That restored stability to our CI, but we also were seeing this:


```

2018-09-24 17:36:13.343 ibtoold[26191:91510369] *** Assertion failure in -[IBMessageSendChannel sendMessage:returnValue:context:error:arguments:], /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-14313.18/Foundation/Utilities/IBMessageChannel.m:184

2018-09-24 17:36:13.444 ibtoold[26191:91510369] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Already shutdown'

*** First throw call stack:

(

0 CoreFoundation 0x00007fff4d7a82db __exceptionPreprocess + 171

1 libobjc.A.dylib 0x00007fff74945c76 objc_exception_throw + 48

2 CoreFoundation 0x00007fff4d7ae072 +[NSException raise:format:arguments:] + 98

3 Foundation 0x00007fff4f8d7340 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193

4 IBFoundation 0x000000010dd31a72 -[IBMessageSendChannel sendMessage:returnValue:context:error:arguments:] + 2566

5 IDEInterfaceBuilderCocoaTouchIntegration 0x000000011b5c76d6 __159-[IBCocoaTouchImageCatalogToolProxy compileItemsWithCatalogRelativeIdentifierPaths:tagSolutionSpace:andStickerPacksWithCatalogRelativeIdentifierPaths:options:]_block_invoke + 132

6 IDEInterfaceBuilderKit 0x000000010cb2f528 -[IBAbstractPlatformToolProxy _ON_QUEUE_sendMessage:toChannelReturningError:during:] + 162

7 IDEInterfaceBuilderKit 0x000000010cb2f3a8 __74-[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:]_block_invoke + 38

8 libdispatch.dylib 0x00007fff75525db8 _dispatch_client_callout + 8

9 libdispatch.dylib 0x00007fff755391e1 _dispatch_queue_barrier_sync_invoke_and_complete + 60

10 DVTFoundation 0x000000010d59a3db DVTDispatchSync + 208

11 IDEInterfaceBuilderKit 0x000000010cb2f2cb -[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:] + 245

12 IDEInterfaceBuilderCocoaTouchIntegration 0x000000011b5c75f4 -[IBCocoaTouchImageCatalogToolProxy compileItemsWithCatalogRelativeIdentifierPaths:tagSolutionSpace:andStickerPacksWithCatalogRelativeIdentifierPaths:options:] + 220

13 IDEInterfaceBuilderCocoaTouchIntegration 0x000000011b5aeb3a -[IBICAbstractCocoaTouchPlatformAdapter compileCARItems:tagSolutionSpace:options:queue:completionHandler:] + 940

14 IDEInterfaceBuilderKit 0x000000010ca7dbad __84-[IBICAbstractPlatformAdapter compileSelectedItems:options:queue:completionHandler:]_block_invoke + 228

15 IDEInterfaceBuilderKit 0x000000010ca80fb4 __93-[IBICAbstractPlatformAdapter compileStandaloneCatalogItems:options:queue:completionHandler:]_block_invoke + 18

16 DVTFoundation 0x000000010d59a45e __DVTDispatchAsync_block_invoke + 97

17 libdispatch.dylib 0x00007fff7552d5fa _dispatch_call_block_and_release + 12

18 libdispatch.dylib 0x00007fff75525db8 _dispatch_client_callout + 8

19 libdispatch.dylib 0x00007fff75531395 _dispatch_main_queue_callback_4CF + 1148

20 CoreFoundation 0x00007fff4d760c19 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9

21 CoreFoundation 0x00007fff4d722dfa __CFRunLoopRun + 2586

22 CoreFoundation 0x00007fff4d722153 CFRunLoopRunSpecific + 483

23 DVTFoundation 0x000000010d41fd3e -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:whileBlockExecutesConcurrently:] + 457

24 DVTFoundation 0x000000010d4201e9 -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:waitingForSemaphore:] + 128

25 ibtoold 0x000000010c7f7850 -[IBCLIImageCatalogToolPersona compileCatalogCollection:withPlatformAdapter:arguments:outputDictionary:] + 1622

26 ibtoold 0x000000010c7f9087 -[IBCLIImageCatalogToolPersona invokeArguments:outputDictionary:] + 1785

27 ibtoold 0x000000010c7f9631 -[IBCLIImageCatalogToolPersona runSingleInvocation:outputtingToFileHandle:andVerifyingEnvironment:] + 709

28 ibtoold 0x000000010c8070e7 IBCLIServerRunSingleInvocation + 520

29 ibtoold 0x000000010c80773e __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke_2 + 34

30 ibtoold 0x000000010c80760c __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke + 857

31 ibtoold 0x000000010c7f63f5 -[IBCLIErrorForwarder forwardErrorOutputToDescriptor:whileInvokingBlock:] + 110

32 ibtoold 0x000000010c806c9d IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess + 581

33 ibtoold 0x000000010c805a7d main + 2673

34 libdyld.dylib 0x00007fff7555f015 start + 1

)

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

```


The "already shutdown" part makes me think that this is also simulator related.


Other than killing the `CoreSimulatorService` process, what else could I try that might help reset the simulator state here? Seeing these issues with Xcode 10 final release.

Replies

Did you find a solution? I am running in to the same error when compiling an asset catalog with pdfs, but aren't switching Xcode versions on the CI.