Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msbuild] Have XcodeCompilerToolTask use xcrun to start Apple tools (#9965) #9972

Merged
merged 2 commits into from
Oct 28, 2020

Conversation

spouliot
Copy link
Contributor

  1. Use xcrun to run ibtool (and actool) and avoid toolchain mismatches

  2. Set DEVELOPER_DIR so everyone (well xcrun) use the same toolchain

  3. Workaround for macos-arm64 issue (FB8827920)

    • Start ibtool as an Apple [Silicon] process
    • This will ensure the ibtoold daemon is also running as Apple
    • If ibtoold is run as Intel then ibtool asserts and build fail
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.757 ibtoold[37142:6681382] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBAbstractInterfaceBuilderPlatformToolManager.m:481
LaunchScreen.storyboard : error : Details:  Failed to attach to IBAgent-iOS with error: Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." UserInfo={NSLocalizedFailureReason=IBAgent-iOS (37146) failed to launch and exited with status 10, NSUnderlyingError=0x7fa4e58fc760 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to launch IBAgent-iOS via CoreSimulator spawn" UserInfo={NSLocalizedDescription=Failed to launch IBAgent-iOS via CoreSimulator spawn, NSUnderlyingError=0x7fa4e5e8a900 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to handshake with platform tool" UserInfo={NSLocalizedFailureReason=Failed to open connection over FIFOs with platform tool, NSLocalizedDescription=Failed to handshake with platform tool, NSUnderlyingError=0x7fa4e5e237c0 {Error Domain=com.apple.InterfaceBuilder Code=-1 "" UserInfo=0x7fa4e5e8bba0 (not displayed)}}}}}, NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "IBAgent-iOS" for further information., NSLocalizedDescription=Encountered an error communicating with IBAgent-iOS.}
LaunchScreen.storyboard : error : Object:   <IBCocoaTouchToolManager>
LaunchScreen.storyboard : error : Method:   +_THREADSAFE_launchNewToolWithLaunchContext:executionContext:toolProxyClass:proxyDelegate:failureContext:requestingMethod:error:forReason:
LaunchScreen.storyboard : error : Thread:   <NSThread: 0x7fa4e341af70>{number = 1, name = main}
LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.766 ibtoold[37142:6681382] [MT] IBPlatformTool: *** Failed to launch tool with description <IBCocoaTouchPlatformToolDescription: 0x7fa4e5f34160> System content for IBCocoaTouchFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7fa4e5f2fb50> scaleFactor=2x, renderMode.identifier=(null): Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS (37146) failed to launch and exited with status 10): Failed to launch IBAgent-iOS via CoreSimulator spawn: Failed to handshake with platform tool (Failure reason: Failed to open connection over FIFOs with platform tool): : Failed to open FIFOs for handshaking with platform tool (Failure reason: IBAgent-iOS exited before we could handshake)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error : ibtool exited with code 1
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error :
LaunchScreen.storyboard : ibtool error : Encountered an error communicating with IBAgent-iOS.

Note: main has diverged quite a bit (net6 support) so this pull request
will need to be re-worked (it won't apply)

Fixes #4634

Foreport of #9965 since the source code diverged from xcode12.2

…ls (xamarin#9965)

1. Use `xcrun` to run `ibtool` (and `actool`) and avoid toolchain mismatches

2. Set `DEVELOPER_DIR` so everyone (well `xcrun`) use the same toolchain

3. Workaround for `macos-arm64` issue (FB8827920)

	* Start `ibtool` as an `Apple` [Silicon] process
	* This will ensure the `ibtoold` daemon is also running as `Apple`
	* If `ibtoold` is run as `Intel` then `ibtool` asserts and build fail

```
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.757 ibtoold[37142:6681382] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBAbstractInterfaceBuilderPlatformToolManager.m:481
LaunchScreen.storyboard : error : Details:  Failed to attach to IBAgent-iOS with error: Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." UserInfo={NSLocalizedFailureReason=IBAgent-iOS (37146) failed to launch and exited with status 10, NSUnderlyingError=0x7fa4e58fc760 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to launch IBAgent-iOS via CoreSimulator spawn" UserInfo={NSLocalizedDescription=Failed to launch IBAgent-iOS via CoreSimulator spawn, NSUnderlyingError=0x7fa4e5e8a900 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to handshake with platform tool" UserInfo={NSLocalizedFailureReason=Failed to open connection over FIFOs with platform tool, NSLocalizedDescription=Failed to handshake with platform tool, NSUnderlyingError=0x7fa4e5e237c0 {Error Domain=com.apple.InterfaceBuilder Code=-1 "" UserInfo=0x7fa4e5e8bba0 (not displayed)}}}}}, NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "IBAgent-iOS" for further information., NSLocalizedDescription=Encountered an error communicating with IBAgent-iOS.}
LaunchScreen.storyboard : error : Object:   <IBCocoaTouchToolManager>
LaunchScreen.storyboard : error : Method:   +_THREADSAFE_launchNewToolWithLaunchContext:executionContext:toolProxyClass:proxyDelegate:failureContext:requestingMethod:error:forReason:
LaunchScreen.storyboard : error : Thread:   <NSThread: 0x7fa4e341af70>{number = 1, name = main}
LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.766 ibtoold[37142:6681382] [MT] IBPlatformTool: *** Failed to launch tool with description <IBCocoaTouchPlatformToolDescription: 0x7fa4e5f34160> System content for IBCocoaTouchFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7fa4e5f2fb50> scaleFactor=2x, renderMode.identifier=(null): Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS (37146) failed to launch and exited with status 10): Failed to launch IBAgent-iOS via CoreSimulator spawn: Failed to handshake with platform tool (Failure reason: Failed to open connection over FIFOs with platform tool): : Failed to open FIFOs for handshaking with platform tool (Failure reason: IBAgent-iOS exited before we could handshake)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error : ibtool exited with code 1
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error :
LaunchScreen.storyboard : ibtool error : Encountered an error communicating with IBAgent-iOS.
```

Note: `main` has diverged quite a bit (net6 support) so this pull request
will need to be re-worked (it won't apply)

Fixes xamarin#4634

Foreport of xamarin#9965 since the source code diverged from `xcode12.2`
@spouliot spouliot added the enhancement The issue or pull request is an enhancement label Oct 27, 2020
@@ -711,15 +712,15 @@ public void BuildingSameSolutionTwice_ShouldNotRunACToolTwice ()
string project = TI.GenerateUnifiedExecutableProject (test);

string buildOutput = TI.BuildProject (project);
Assert.True (buildOutput.Contains ("actool execution started with arguments"), $"Initial build should run actool");
Assert.True (buildOutput.Contains (actool), $"Initial build should run actool");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious if there is a reason to use the $ before the string if we do not use any variables inside it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I did not notice it in the original source (or I would have removed it).

@monojenkins
Copy link
Collaborator

Build failure
Provisioning succeeded
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

48 tests failed, 19 tests passed.

Failed tests

  • monotouch-test/iOS Unified 64-bits - simulator/Debug: BuildFailure
  • monotouch-test/iOS Unified 64-bits - simulator/Debug (LinkSdk): BuildFailure
  • monotouch-test/iOS Unified 64-bits - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/iOS Unified 64-bits - simulator/Release (all optimizations): BuildFailure
  • monotouch-test/tvOS - simulator/Debug: BuildFailure
  • monotouch-test/tvOS - simulator/Debug (LinkSdk): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/tvOS - simulator/Release (all optimizations): BuildFailure
  • monotouch-test/watchOS 32-bits - simulator/Debug: BuildFailure
  • monotouch-test/watchOS 32-bits - simulator/Debug (LinkSdk): BuildFailure
  • monotouch-test/watchOS 32-bits - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/watchOS 32-bits - simulator/Release (all optimizations): BuildFailure
  • introspection/iOS Unified 64-bits - simulator/Debug: BuildFailure
  • introspection/iOS Unified 64-bits - simulator/Debug [dotnet]: BuildFailure
  • introspection/tvOS - simulator/Debug: BuildFailure
  • introspection/watchOS 32-bits - simulator/Debug: BuildFailure
  • dont link/iOS Unified 64-bits - simulator/Debug: BuildFailure
  • dont link/iOS Unified 64-bits - simulator/Release: BuildFailure
  • dont link/iOS Unified 64-bits - simulator/Debug [dotnet]: BuildFailure
  • dont link/iOS Unified 64-bits - simulator/Release [dotnet]: BuildFailure
  • dont link/tvOS - simulator/Debug: BuildFailure
  • dont link/tvOS - simulator/Release: BuildFailure
  • dont link/watchOS 32-bits - simulator/Debug: BuildFailure
  • dont link/watchOS 32-bits - simulator/Release: BuildFailure
  • link all/iOS Unified 64-bits - simulator/Debug: BuildFailure
  • link all/iOS Unified 64-bits - simulator/Release: BuildFailure
  • link all/iOS Unified 64-bits - simulator/Debug [dotnet]: BuildFailure
  • link all/iOS Unified 64-bits - simulator/Release [dotnet]: BuildFailure
  • link all/tvOS - simulator/Debug: BuildFailure
  • link all/tvOS - simulator/Release: BuildFailure
  • link all/watchOS 32-bits - simulator/Debug: BuildFailure
  • link all/watchOS 32-bits - simulator/Release: BuildFailure
  • link sdk/iOS Unified 64-bits - simulator/Debug: BuildFailure
  • link sdk/iOS Unified 64-bits - simulator/Release: BuildFailure
  • link sdk/iOS Unified 64-bits - simulator/Debug [dotnet]: BuildFailure
  • link sdk/iOS Unified 64-bits - simulator/Release [dotnet]: BuildFailure
  • link sdk/tvOS - simulator/Debug: BuildFailure
  • link sdk/tvOS - simulator/Release: BuildFailure
  • link sdk/watchOS 32-bits - simulator/Debug: BuildFailure
  • link sdk/watchOS 32-bits - simulator/Release: BuildFailure
  • framework-test/watchOS 32-bits - simulator/Debug: BuildFailure
  • fsharp/watchOS 32-bits - simulator/Debug: BuildFailure
  • interdependent-binding-projects/watchOS 32-bits - simulator/Debug: BuildFailure
  • mono-native-compat/watchOS 32-bits - simulator/Debug: BuildFailure
  • mono-native-unified/watchOS 32-bits - simulator/Debug: BuildFailure
  • MSBuild tests/iOS (tasks): Failed (Execution failed with exit code 4)
  • MSBuild tests/iOS (integration): Failed (Execution failed with exit code 77)
  • DotNet tests: Failed (Execution failed with exit code 1)

@monojenkins
Copy link
Collaborator

Build success
Provisioning succeeded
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
Test run succeeded

@spouliot spouliot merged commit 7e85482 into xamarin:main Oct 28, 2020
@spouliot spouliot deleted the main-ibtool-xcrun branch October 28, 2020 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[msbuild] Use xcrun everywhere to pick Apple tools
5 participants