pendo-io / pendo-mobile-sdk

Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value
https://www.pendo.io
Other
57 stars 2 forks source link

clang++ exited with code 1 when compiling for ios-simulator on arm64 #87

Closed albyrock87 closed 6 months ago

albyrock87 commented 9 months ago

Platform + Version iOS ARM64 Simulator (Mac M1...M3)

SDK Version 3.0.0.7965

Framework MAUI .NET 8

Describe the bug This is the same issue AppCenter library has: https://github.com/microsoft/appcenter-sdk-dotnet/issues/1755

When targeting iOS Simulator on MacBook M1 (arm64) there's no way to compile the project with Pendo included as package reference.

To Reproduce Using a MacBook M1..3 Create a MAUI project Embed Pendo as described in docs Compile targeting iOS Simulator.

Expected behavior Project builds.

Logs

 Build / Console Error 1: 
 bash
 3>Xamarin.Shared.Sdk.targets(1556,3): Error  : clang++ exited with code 1:
 ld: building for iOS Simulator, but linking in dylib built for iOS, file '......obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/Pendo.framework/Pendo'
 clang: error: linker command failed with exit code 1 (use -v to see invocation)
velocitysystems commented 9 months ago

@albyrock87 Ran into this same issue. Are you trying to compile with Rider? As a workaround, I can build/deploy to the iOS simulator with VS for Mac with the .NET 8 preview feature turned on.

This is not an issue with the pendo-maui package itself but rather the SDK build/deployment tooling.

albyrock87 commented 9 months ago

Yes, I'm using Rider.. so do you think that this issue should be opened on JetBrains issue tracker?

This issue was initially opened in MAUI repo and they said it was AppCenter fault and not a MAUI SDK issue.

I think there's a lot of confusion around this.

velocitysystems commented 9 months ago

@albyrock87 I believe this is due to incomplete support for .NET 8 tooling in Rider. You may wish to raise this issue or add it to the already open ticket(s) with Jetbrains. However, I can confirm this is not an issue with MAUI, App Center or Pendo. It is a deployment issue with Rider.

albyrock87 commented 9 months ago

Alright, I will proceed that way for now, thanks.

albyrock87 commented 8 months ago

@velocitysystems I'll reopen the issue because this is not a problem with Rider: I can reproduce it using a standalone terminal

dotnet build MyProject -f net8.0-ios -r iossimulator-arm64
Tool xcrun execution started with arguments: clang++ -force_load /Users/myuser/.nuget/packages/sqlitepclraw.lib.e_sqlcipher.ios/2.1.7/buildTransitive/../static/simulator/e_sqlcipher.a -Lobj/Debug/net8.0-ios/iossimulator-arm64/nativelibraries -lSystem.Globalization.Native -lSystem.IO.Compression.Native -lSystem.Native -lSystem.Net.Security.Native -lSystem.Security.Cryptography.Native.Apple -lmono-component-debugger -lmono-component-diagnostics_tracing -lmono-component-hot_reload -lmono-component-marshal-ilgen -lmonosgen-2.0 -lxamarin-dotnet-debug -miphonesimulator-version-min=11.0 -isysroot /Applications/Xcode15.0.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk -arch arm64 /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/nativelibraries/aot-output/arm64/System.Private.CoreLib.dll.o -L/usr/local/share/dotnet/packs/Microsoft.iOS.Runtime.iossimulator-arm64/17.0.8478/runtimes/iossimulator-arm64/native -lxamarin-dotnet-debug -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lSystem.Globalization.Native -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lSystem.IO.Compression.Native -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lSystem.Native -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lSystem.Net.Security.Native -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lSystem.Security.Cryptography.Native.Apple -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lmono-component-debugger -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lmono-component-diagnostics_tracing -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lmono-component-hot_reload -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lmono-component-marshal-ilgen -L/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64/8.0.0/runtimes/iossimulator-arm64/native -lmonosgen-2.0 -force_load /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/AppCenter.a -force_load /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/AppCenterAnalytics.a -force_load /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/AppCenterCrashes.a /usr/local/share/dotnet/packs/Microsoft.iOS.Runtime.iossimulator-arm64/17.0.8478/runtimes/iossimulator-arm64/native/Microsoft.iOS.registrar.a -rpath @executable_path -F /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache -framework Pendo -framework Accelerate -framework Accounts -framework AddressBook -framework AddressBookUI -framework AdSupport -framework ARKit -framework AssetsLibrary -framework AudioToolbox -framework AVFoundation -framework AVKit -framework CallKit -framework CFNetwork -framework CloudKit -framework Contacts -framework ContactsUI -framework CoreAudioKit -framework CoreBluetooth -framework CoreData -framework CoreFoundation -framework CoreGraphics -framework CoreImage -framework CoreLocation -framework CoreMedia -framework CoreMIDI -framework CoreML -framework CoreMotion -framework CoreSpotlight -framework CoreTelephony -framework CoreText -framework CoreVideo -framework DeviceCheck -framework EventKit -framework EventKitUI -framework ExternalAccessory -framework FileProvider -framework FileProviderUI -framework Foundation -framework GameController -framework GameKit -framework GameplayKit -framework GLKit -framework HealthKit -framework HealthKitUI -framework HomeKit -framework IdentityLookup -framework ImageIO -framework Intents -framework IntentsUI -framework JavaScriptCore -framework LocalAuthentication -framework MapKit -framework MediaAccessibility -framework MediaPlayer -framework MediaToolbox -framework Messages -framework MessageUI -framework Metal -framework MetalKit -framework MetalPerformanceShaders -framework MobileCoreServices -framework ModelIO -framework MultipeerConnectivity -framework NetworkExtension -framework NotificationCenter -framework OpenGLES -framework PassKit -framework PDFKit -framework Photos -framework PhotosUI -framework PushKit -framework QuartzCore -framework QuickLook -framework ReplayKit -framework SafariServices -framework SceneKit -framework Security -framework Social -framework Speech -framework SpriteKit -framework StoreKit -framework SystemConfiguration -framework Twitter -framework UIKit -framework UserNotifications -framework UserNotificationsUI -framework VideoSubscriberAccount -framework VideoToolbox -framework Vision -framework WatchConnectivity -framework WebKit -weak_framework Accessibility -weak_framework AdServices -weak_framework AppClip -weak_framework AppTrackingTransparency -weak_framework AuthenticationServices -weak_framework AutomaticAssessmentConfiguration -weak_framework AVRouting -weak_framework BackgroundAssets -weak_framework BackgroundTasks -weak_framework BusinessChat -weak_framework CarPlay -weak_framework ClassKit -weak_framework CoreHaptics -weak_framework CoreLocationUI -weak_framework IdentityLookupUI -weak_framework LinkPresentation -weak_framework MetalPerformanceShadersGraph -weak_framework MetricKit -weak_framework NaturalLanguage -weak_framework NearbyInteraction -weak_framework Network -weak_framework OSLog -weak_framework PencilKit -weak_framework PushToTalk -weak_framework QuickLookThumbnailing -weak_framework ScreenTime -weak_framework SensitiveContentAnalysis -weak_framework SensorKit -weak_framework SharedWithYou -weak_framework SharedWithYouCore -weak_framework SoundAnalysis -weak_framework Symbols -weak_framework UniformTypeIdentifiers -weak_framework VisionKit -framework GSS -framework CFNetwork -framework CoreTelephony -framework Security -framework SystemConfiguration -F /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache -framework Pendo -rpath @executable_path/Frameworks /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/nativelibraries/main.arm64.o -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/Entitlements.xcent -o /Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/nativelibraries/MyProject -lsqlite3 -lc++ -lsqlite3 -lcompression -lz -liconv -lcompression -lobjc -exported_symbols_list obj/Debug/net8.0-ios/iossimulator-arm64/mtouch-symbols.list -Xlinker -ld_classic
 Assembly loaded during TaskRun (Xamarin.MacDev.Tasks.LinkNativeCode): System.Collections.Specialized, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Collections.Specialized.dll, MVID: d4ad31ca-0b44-4657-a491-0a39304905ef, AppDomain: [Default]) (TaskId:277)
 Tool xcrun execution finished (exit code = 1).
 ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/myuser/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/Pendo.framework/Pendo'
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8478/targets/Xamarin.Shared.Sdk.targets(1556,3): error : clang++ exited with code 1: [/Users/myusername/my-project/MyProject/MyProject.csproj::TargetFramework=net8.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8478/targets/Xamarin.Shared.Sdk.targets(1556,3): error : ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/myusername/my-project/MyProject/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/Pendo.framework/Pendo' [/Users/myusername/my-project/MyProject/MyProject.csproj::TargetFramework=net8.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8478/targets/Xamarin.Shared.Sdk.targets(1556,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation) [/Users/myusername/my-project/MyProject/MyProject.csproj::TargetFramework=net8.0-ios]
MikePendo commented 8 months ago

@albyrock87 We dont support .net8 yet, can u try to build with .net7 and see if u have the same error?

albyrock87 commented 8 months ago

@MikePendo same error, with different text

I've tried using the sample Calculator project from here and adding a global.json + the <PackageReference Include="pendo-maui" Version="3.0.0.7965" />

{
  "sdk": {
    "version": "7.0.100",
    "rollForward": "latestFeature"
  }
}
dotnet --version
7.0.401
dotnet build Calculator -f net7.0-ios -r iossimulator-arm64
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7125/targets/Xamarin.Shared.Sdk.targets(1276,3): error : clang++ exited with code 1: [/Users/myuser/Downloads/maui-samples-20ae5ee72d1ecadcd3871cb16153242b6a1a96c3/7.0/Apps/Calculator/src/Calculator/Calculator.csproj::TargetFramework=net7.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7125/targets/Xamarin.Shared.Sdk.targets(1276,3): error : ld: warning: ignoring duplicate libraries: '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmono-component-debugger', '-lmono-component-diagnostics_tracing', '-lmono-component-hot_reload', '-lmonosgen-2.0', '-lxamarin-dotnet-debug' [/Users/myuser/Downloads/maui-samples-20ae5ee72d1ecadcd3871cb16153242b6a1a96c3/7.0/Apps/Calculator/src/Calculator/Calculator.csproj::TargetFramework=net7.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7125/targets/Xamarin.Shared.Sdk.targets(1276,3): error : ld: building for 'iOS-simulator', but linking in dylib (/Users/myuser/Downloads/maui-samples-20ae5ee72d1ecadcd3871cb16153242b6a1a96c3/7.0/Apps/Calculator/src/Calculator/obj/Debug/net7.0-ios/iossimulator-arm64/linker-cache/Pendo.framework/Pendo) built for 'iOS' [/Users/myuser/Downloads/maui-samples-20ae5ee72d1ecadcd3871cb16153242b6a1a96c3/7.0/Apps/Calculator/src/Calculator/Calculator.csproj::TargetFramework=net7.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7125/targets/Xamarin.Shared.Sdk.targets(1276,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation) [/Users/myuser/Downloads/maui-samples-20ae5ee72d1ecadcd3871cb16153242b6a1a96c3/7.0/Apps/Calculator/src/Calculator/Calculator.csproj::TargetFramework=net7.0-ios]

I think that this comment and this other comment explain what's happening.

MikePendo commented 8 months ago

@albyrock87 we have opened internal issue on our end: APP-93615 and we will look in to this issue soon

MikePendo commented 8 months ago

@albyrock87 I have looked at the run time environments here:rid-catalog and I didnt find yours iossimulator-arm64. The one that I did find is ios-arm64. (I saw yours in GitHub issues but not in the official docs). Maybe its only for devices and not for simulators but I believe it should also work in M1 (I might be wrong here) I have download the project and tried to build with that run time and it worked for me . I changed the project a little project snippets To allow only iOS with .net7 and run the following: dotnet build Calculator -r ios-arm64 Can it try on your side?

albyrock87 commented 8 months ago

@MikePendo I will try, but as far as I know, this is the PR introducing that RID, and it appears to me it targets .NET6 release especially considering it's from March 2021. https://github.com/dotnet/runtime/pull/49305

Apparently the documentation you linked is not up to date.

albyrock87 commented 8 months ago

Actually look in this section: https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids

The following list shows a small subset of the most common RIDs used for each OS. For the latest and complete version, see the PortableRuntimeIdentifierGraph.json in the dotnet/sdk repository.

https://github.com/dotnet/sdk/blob/main/src/Layout/redist/PortableRuntimeIdentifierGraph.json

MikePendo commented 8 months ago

@albyrock87 Unfortunately my knowledge related to Xamarin/Maui is limited. I have opened an issue here: https://github.com/dotnet/maui/issues/19406 Lets see what they can say, we will also discuss it internally

velocitysystems commented 8 months ago

@albyrock87 Rider 2023.3.1 has been released and references a fix for a related issue. https://youtrack.jetbrains.com/issue/RIDER-76794/Cannot-deploy-MAUI-project-to-physical-iOS-device-because-of-RuntimeIdentifier

cleardemon commented 7 months ago

Would be nice to have a fix for this, especially since more will be updating to .NET 8 over time!

It seems having Pendo compile their DLL to use a proper .xcframework package that outputs for each architecture and configuration appropriately is the way to go (as discussed in the issue raised in the MAUI repo). There are various links on the Internet about moving from .framework to .xcframework: strava, fusion, apple.

Currently, the only workaround I can find for Pendo is to use Visual Studio for Mac (with .NET 8 support enabled in Preview Features), and forcing it to use iossimulator-x64 in the app csproj. Or, simply, removing Pendo entirely from the build. Neither of these workarounds are ideal.

In response to other comments above, Rider now works fine with .NET 8 since their recent update.

Also to reiterate, I am not observing this issue on actual iOS devices, it is purely an iOS Simulator issue. Developer quality of life is as important as end-users (we are end-users too! 😄)

MikePendo commented 7 months ago

@cleardemon We are working on it. @udilevin any progress about it?

udilevin commented 7 months ago

XCFramework support in MAUI will be part of our next release.

albyrock87 commented 7 months ago

Thank you @udilevin , very much appreciated!

MikePendo commented 6 months ago

@albyrock87 @cleardemon @velocitysystems The issue should be resolved for MAUI I will close the issue, feel free to ping us

shlomipendo commented 6 months ago

FYI, The relevant version for this fix is 3.1.0

albyrock87 commented 6 months ago

Thank you very much!