简体   繁体   中英

Xamrin iOS - AOT compilation fails from mac but builds fine from pc

I created that simple xamarin forms app (with just iOS). It does nothing but referencing that signalr nuget package.

When I build Debug | iPhone Debug | iPhone from Visual Studio on my pc (connected to my mac), it builds fine and especially does AOT compilation for Microsoft.AspNetCore.Sockets.Abstractions.dll (as well as all other dlls).

However, when I build the same solution on Visual Studio for Mac, also on Debug | iPhone Debug | iPhone , I get the following error:

Could not AOT the assembly '/Users/francois/AotTests/AotTests/AotTests.iOS/obj/iPhone/Debug/mtouch-cache/Build/Microsoft.AspNetCore.Sockets.Abstractions.dll' (MT3001) (AotTests.iOS)}

Bonjour,

TL;DR

This has been fixed in https://github.com/xamarin/xamarin-macios/pull/3791 and we are trying to get it in our next stable release (aka 15.7).

You can try the fix with our continuous builds here: https://github.com/xamarin/xamarin-macios/wiki#continuous-builds .
In this case you want builds from master (hopefully soon from our 15.7 previous currently in alpha/beta).


What happened?

The NuGet package you added ( Microsoft.AspNetCore.SignalR.Client ) was added via a new "package reference" mechanism and had dependencies (other packages) that had both /lib and /ref folders.

On the Mac, MSBuild's ResolveAssemblyReferences target resolved the reference assemblies (in /ref ), passed them to csc to compile and because of that mtouch (our packaging tool) was also given those reference assemblies.
The problem is that we can't AOT them, they're only facades and are not made to be packaged.

We solved the issue in Xamarin.iOS (there might be a more general msbuild fix in the future) by stripping the right reference assemblies, given as output by the Nuget targets in _ReferencesFromNuGetPackages .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM