BarcodeScanner.Mobile
BarcodeScanner.Mobile copied to clipboard
[iOS] Clang++ exited with code 1
Describe the bug When connecting to a remote Mac, attempting the run the application will give the following error:
2>clang: error: linker command failed with exit code 1 (use -v to see invocation)
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : clang++ exited with code 1:
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : ld: in /Users/kklose/Library/Caches/Xamarin/mtbs/builds/Mobile.Project/be694607f184f9d3161d9b97862b6101495b72529aa39a5488a5e6706878b158/C:/Users/kklose/AppData/Local/XamarinBuildDownloadCache/MLKVision-3.0.0/Frameworks/MLKitVision.framework/MLKitVision(aligned_new_bca0ac320467a2457b3e306bfed17856.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/kklose/Library/Caches/Xamarin/mtbs/builds/Mobile.Project/be694607f184f9d3161d9b97862b6101495b72529aa39a5488a5e6706878b158/C:/Users/kklose/AppData/Local/XamarinBuildDownloadCache/MLKVision-3.0.0/Frameworks/MLKitVision.framework/MLKitVision' for architecture arm64
2>C:\Program Files\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)
I am using the new .NET 8 update
Experiencing the same on Mac on Rider
ld: in ~Library/Caches/XamarinBuildDownload/MLImg-1.0.0beta2/Frameworks/MLImage.framework/MLImage(aligned_new_bca0ac320467a2457b3e306bfed17856.o),
building for iOS Simulator, but linking in object file built for iOS,
file '~/Library/Caches/XamarinBuildDownload/MLImg-1.0.0beta2/Frameworks/MLImage.framework/MLImage' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)``` it seems the nuget doesnt include some native resources for iOS sim? I know its not possible to use the scanner in the sim but that means we cant continue building the project either if we cant build and deploy to simulator. It wasnt an issue with previous releases. Please have a look when u have a sec. Thank you for supporting the community!
@JimmyPun610 Maybe it makes sense to migrate iOS implementation to https://developer.apple.com/documentation/vision (similar to this one https://github.com/afriscic/BarcodeScanning.Native.Maui), since it's a bit harder to work with MLKit for iOS
attaching a repro, this repo will build on VS for Mac, but fails on Rider and VS Code @ MauiAppDotNet8.zip
If you remove the barcode scanner package, it builds everywhere :(
The problem is that this NuGet doesn't support the arm64 architecture in the simulator.
See https://github.com/xamarin/xamarin-macios/wiki/.NET-8-release-notes#default-runtimeidentifiers for more information.