xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.44k stars 510 forks source link

Failed to AOT compile Microsoft.Graph.dll, Regression #21013

Closed jbe2277 closed 1 month ago

jbe2277 commented 1 month ago

Steps to Reproduce

  1. Clone https://github.com/jbe2277/waf
  2. Open NewsReader.sln
  3. Build iOS version in Release Mode

Expected Behavior

Build should succeed. The GitHub project has an action that builds the iOS version. This takes about 3 minutes.

Successful build:

Actual Behavior

GitHub runner goes for about 3 hours to build the iOS version. Result:

/Users/runner/.dotnet/packs/Microsoft.iOS.Sdk.net8.0_17.5/17.5.8018/targets/Xamarin.Shared.Sdk.targets(1270,3): 
error : Failed to AOT compile Microsoft.Graph.dll, the AOT compiler exited with code 1. 
[/Users/runner/work/waf/waf/src/NewsReader/NewsReader.MauiSystem/NewsReader.MauiSystem.csproj::TargetFramework=net8.0-ios]

Changes from the successful build to the actual one

Related issues

rolfbjarne commented 1 month ago

I can reproduce the slowness, but not the crash. The crash might be due to excessive memory consumption though, in which case that might not happen on my machine.

However, there's a major difference between the two builds: the working build builds using the RuntimeIdentifier iossimulator-x64, while the failing one builds using the RuntimeIdentifier iossimulator-arm64. This is probably due to changing the GitHub runner (the default RuntimeIdentifier depends on the architecture of the Mac: on arm64 macs we build for iossimulator-arm64 by default, otherwise iossimulator-x64).

There are a couple of things coming together here:

There are a couple of potential fixes:

<PropertyGroup>
    <UseInterpreter>true</UseInterpreter>
</PropertyGroup>
<PropertyGroup>
    <MtouchLink>SdkOnly</MtouchLink>
</PropertyGroup>

Can you try either of these and see if it works?

jbe2277 commented 1 month ago

I have enabled the trimmer - this solved the issue.

rolfbjarne commented 1 month ago

I have enabled the trimmer - this solved the issue.

Great, I'll close this then. Thanks for confirming!