realm-dotnet icon indicating copy to clipboard operation
realm-dotnet copied to clipboard

[Bug]: No matching framework found inside realm-wrappers.xcframework

Open scarabdesign opened this issue 3 years ago • 8 comments

What happened?

My Xamarin iOS app compiles fine for the simulator. My app with previous versions of Realm 10 (would be 5) compiles and ran fine on my iOS devices. With Realm 10.x I get an error in Visual Studio trying to deploy the app to any iOS device.

Error No matching framework found inside 'C:\Users\akamr\.nuget\packages\realm\10.5.1\build\..\native\ios\universal\realm-wrappers.xcframework'. SupportedPlatform: 'ios', SupportedPlatformVariant: '', SupportedArchitectures: 'ARMv7, ARMv7s, ARM64'.

I've verified that my device is indeed Armv7. The error happens on Visual Studio for Windows and VS Mac as well.

The "Supported Architectures" listed in the properties of the project are: ARMv7, ARMv7s, ARM64

Repro steps

Install Realm 10.x via Nuget, pair VS to the mac, target ios device with valid provisioning profile, try to build and deploy to the device.

Version

min required for Xamarin.ios

What SDK flavour are you using?

Local Database only

What type of application is this?

Xamarin

Client OS and version

iOS 14.4

Code snippets

No response

Stacktrace of the exception/crash you're getting

1>  ERPXamarin.iOS -> D:\Projects\ERPXamarin_iOS\ERPXamarin\ERPXamarin.iOS\bin\iPhone\Debug\ERPXamarin.iOS.exe
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.Shared.targets(145,3): error : No matching framework found inside 'C:\Users\akamr\.nuget\packages\realm\10.5.1\build\..\native\ios\universal\realm-wrappers.xcframework'.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.Shared.targets(145,3): error :          SupportedPlatform: 'ios', SupportedPlatformVariant: '', SupportedArchitectures: 'ARMv7, ARMv7s, ARM64'.

Relevant log output

Severity	Code	Description	Project	File	Line	Suppression State
Error		No matching framework found inside 'C:\Users\akamr\.nuget\packages\realm\10.5.1\build\..\native\ios\universal\realm-wrappers.xcframework'.
         SupportedPlatform: 'ios', SupportedPlatformVariant: '', SupportedArchitectures: 'ARMv7, ARMv7s, ARM64'.	ERPXamarin.iOS

scarabdesign avatar Sep 27 '21 20:09 scarabdesign

That is quite surprising and definitely something we'll need to investigate. When I do open the nuget package on my local machine, I can see that in the realm-wrappers.xcframework, there's a folder called ios-arm64_armv7 which contains realm-wrappers.framework, which is a fat binary with architecture slices for iOS ARM64 and ARMv7. Can you confirm that you also have the same thing if you navigate to that path using explorer?

Additionally, you say

My app with previous versions of Realm 10 (would be 5) compiles and ran fine on my iOS devices.

Do you mean that your app works with Realm 10.5.0 or that it works with Realm 5.x?

nirinchev avatar Sep 27 '21 21:09 nirinchev

Yes, indeed! Here is a screenshot of the contents at ~.nuget\packages\realm\10.5.1\native\ios\universal\realm-wrappers.xcframework\ios-arm64_armv7\realm-wrappers.framework

Capture

Do you mean that your app works with Realm 10.5.0 or that it works with Realm 5.x?

I meant Realm 5.x, however, I realize that 10.x was running fine on my devices in debug mode as well until the recently but it's hard to determine why the change. It had been some time since I ran against an actual device instead of just simulators.

Updating the device to iOS 15 and, on the mac side, XCode 13 and Xamarin.iOS 15.0.0.6 (which is from github) did not resolve the issue.

scarabdesign avatar Sep 28 '21 16:09 scarabdesign

Can you try using 10.2.1? It's the version before we migrated to use xcframework, so I hope it will unblock you while we investigate this issue.

nirinchev avatar Sep 28 '21 16:09 nirinchev

I'll try it! We are also using Fody; would you recommend a lower version of that too?

scarabdesign avatar Sep 28 '21 16:09 scarabdesign

Well, the plot thickens. I downgraded Realm to 10.2.1 on the mac, and now getting this when trying to deploy to iOS device.

/Users/perpetuatech/Projects/ERPXamarin/ERPXamarin/ERPXamarin/ERPXamarin.iOS/error MT5209: Error: warning: ignoring file /Users/perpetuatech/.nuget/packages/realm/10.2.1/native/ios/universal/realm-wrappers.framework/realm-wrappers, missing required architecture armv7s in file /Users/perpetuatech/.nuget/packages/realm/10.2.1/native/ios/universal/realm-wrappers.framework/realm-wrappers (4 slices) (ERPXamarin.iOS) Native linking

However, at the same time, I'm also getting errors like this (about a hundred of them pointing to google maps) /Users/perpetuatech/Projects/ERPXamarin/ERPXamarin/ERPXamarin/ERPXamarin.iOS/error MT5209: Error: warning: ignoring file /Users/perpetuatech/Library/Caches/XamarinBuildDownload/GMps-3.9.0/Maps/Frameworks/GoogleMaps.framework/GoogleMaps, missing required architecture armv7s in file /Users/perpetuatech/Library/Caches/XamarinBuildDownload/GMps-3.9.0/Maps/Frameworks/GoogleMaps.framework/GoogleMaps (4 slices) (ERPXamarin.iOS) Native linking

So it's looking more like an environmental issue, tho I'm not sure where that would be. Realm 10.5 balks the installation while 10.2.1 just gives an ignore warning (although Visual Studio mac flags them as error instead of warning).

scarabdesign avatar Sep 28 '21 18:09 scarabdesign

Hm, what are your build settings? And what device are you deploying on? I believe only a handful of iOS devices actually run armv7s and even those are capable of running armv7 code, which is why Realm is only built for arm64 and armv7, but it's possible that VS feels compelled to compile for armv7s for some reason.

nirinchev avatar Sep 28 '21 20:09 nirinchev

Oh, you are on to something! As I stated previously, the "Supported Architectures" listed in the properties of the project are: ARMv7, ARMv7s, ARM64. What you just mentioned made me change that to just ARMv7 and ARM64 and that worked! I'm able to upload and start the app from debugging now. This issue might be resolved. I'll update to the latest Realm and see if it holds.

scarabdesign avatar Sep 28 '21 21:09 scarabdesign

Ok, Updated to the latest Realm, issue resolved for me. Not sure what you guys need to do, if anything. But I can't think I'm the only one who would choose ARMv7s from the options in the dropdown, so perhaps this record will help those people as well. I'll defer to you to close.

scarabdesign avatar Sep 28 '21 21:09 scarabdesign