AdamEssenmacher/GoogleApisForiOSComponents

Error: clang++ exited with code 1:

Closed this issue · 9 comments

Hi! Today I updated my Firebase plugings for the MAUI .NET8 to version 3.0.0. 2.0.4) includes Adam's packages in the new version. also, i tried to add ONLy Adam's packages for iOS with the same result. So i assume i did something wrong or have some wrong settings/enviroment

"Plugin.Firebase.Crashlytics" Version="3.0.0"
"Plugin.Firebase.CloudMessaging" Version="3.0.0"

Before were and without Adam's packages:

"Plugin.Firebase.Crashlytics" Version="2.0.3"
"Plugin.Firebase.CloudMessaging" Version="2.0.4"

I am facing such an error. both real devices and simulators. (bin/obj were cleaned, and the app re-builded)

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8053/targets/Xamarin.Shared.Sdk.targets(3,3): Error: clang++ exited with code 1:
Undefined symbols for architecture arm64:
"_GPBClearOneof", referenced from:
_MOBTransform_ClearTransformOneOfCase in MLKitMDD
"OBJC_CLASS$_GPBAny", referenced from:
_descriptor.fields.72 in MLKitMDD
_descriptor.fields.23 in MLKitMDD
_descriptor.fields.87 in MLKitMDD
_descriptor.fields.158 in MLKitMDD
"OBJC_CLASS$_GPBCodedOutputStream", referenced from:
objc-class-ref in MLKitCommon(CCTLogOutputStream.o)
"OBJC_CLASS$_GPBDescriptor", referenced from:
objc-class-ref in MLKitMDD
objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
objc-class-ref in MLKitCommon(VisionExtension.pbobjc.o)
objc-class-ref in MLKitCommon(Barhopper.pbobjc.o)
objc-class-ref in MLKitCommon(Clientanalytics.pbobjc.o)
objc-class-ref in MLKitCommon(LogContext.pbobjc.o)
objc-class-ref in MLKitCommon(UploaderState.pbobjc.o)
...
"OBJC_CLASS$_GPBEnumArray", referenced from:
objc-class-ref in MLKitBarcodeScanning
"OBJC_CLASS$_GPBEnumDe (Zoeller.ZControl.Mobile.MAUI)

Visual studio for MAC 17.6.12 (build 410)
XCode Version 15.3 (15E204a)

Here my .csproj

----------

    <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23.0</SupportedOSPlatformVersion>

    <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">34.0</TargetPlatformMinVersion>

    <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>

    <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">17.2</TargetPlatformMinVersion>
    
    <Configurations>Debug;Release;Test</Configurations>
    <NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
    <iOSBundleIdentifier>$(PackageId)</iOSBundleIdentifier>
    <EnableSGenConc>True</EnableSGenConc>
    <NoWarn>1701;1702;CA1416;</NoWarn>
    <BuildIpa>True</BuildIpa>
    <FirebaseCrashlyticsUploadSymbolsEnabled>True</FirebaseCrashlyticsUploadSymbolsEnabled>
    <FirebaseCrashlyticsUploadSymbolsContinueOnError>True</FirebaseCrashlyticsUploadSymbolsContinueOnError>
    <_ExportSymbolsExplicitly>False</_ExportSymbolsExplicitly>
    <Optimize Condition="'$(Configuration)'!='Debug'">True</Optimize>
    <MtouchUseLlvm Condition="'$(Configuration)'!='Debug'">True</MtouchUseLlvm>
    <MtouchLink Condition="'$(Configuration)'!='Debug'">SdkOnly</MtouchLink>
    <UseInterpreter Condition="'$(Configuration)'!='Debug'">true</UseInterpreter>
    <CreatePackage Condition="'$(Configuration)'=='Debug'">false</CreatePackage>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-android'">
    <AndroidPackageName>$(PackageId)</AndroidPackageName>
    <NoWarn>1701;1702;CA1416;</NoWarn>
    <RunAOTCompilation Condition="'$(Configuration)'!='Debug'">True</RunAOTCompilation>
    <Optimize Condition="'$(Configuration)'!='Debug'">True</Optimize>
    <AndroidLinkTool Condition="'$(Configuration)'!='Debug'">r8</AndroidLinkTool>
    <PublishTrimmed Condition="'$(Configuration)'!='Debug'">True</PublishTrimmed>
    <AndroidStripILAfterAOT Condition="'$(Configuration)'!='Debug'">True</AndroidStripILAfterAOT>
    <AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
    <EnableLLVM>True</EnableLLVM>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="AutoMapper.Collection" Version="10.0.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
<PackageReference Include="IdentityModel" Version="7.0.0" />
<PackageReference Include="libphonenumber-csharp" Version="8.13.37" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.4.0" />
<PackageReference Include="PubSub" Version="4.0.2" />
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
<PackageReference Include="Scrutor" Version="4.2.2" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Mopups" Version="1.3.1" />
<PackageReference Include="PancakeViewCompat" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Xamarin" Version="1.0.0" />
<PackageReference Include="UraniumUI.Material" Version="2.8.1" />
<PackageReference Include="UraniumUI" Version="2.8.1" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
<PackageReference Include="Microsoft.Maui.Controls.Core" Version="8.0.40" />
<PackageReference Include="Plugin.Firebase.Crashlytics" Version="3.0.0" />
<PackageReference Include="Plugin.Firebase.CloudMessaging" Version="3.0.0" />
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
<PackageReference Include="BarcodeScanner.Mobile.Maui" Version="8.0.21" />
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="121.0.1.4" />
<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.8.1.1" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.1.1" />
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.6.2.1" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.6" />
<!-- Target needed until LinkWithSwiftSystemLibraries makes it into the SDK: https://github.com/xamarin/xamarin-macios/pull/20463 -->
<_SwiftPlatform Condition="$(RuntimeIdentifier.StartsWith('iossimulator-'))">iphonesimulator <_SwiftPlatform Condition="$(RuntimeIdentifier.StartsWith('ios-'))">iphoneos <_CustomLinkFlags Include="-L" /> <_CustomLinkFlags Include="/usr/lib/swift" /> <_CustomLinkFlags Include="-L" /> <_CustomLinkFlags Include="$(_SdkDevPath)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(_SwiftPlatform)" /> <_CustomLinkFlags Include="-Wl,-rpath" /> <_CustomLinkFlags Include="-Wl,/usr/lib/swift" /> Screenshot 2024-05-30 at 13 01 03

Try switching BarcodeScanner.Mobile.Maui to version 8.0.0.1, we're running into the same compile issue when referencing that component.

Try switching BarcodeScanner.Mobile.Maui to version 8.0.0.1, we're running into the same compile issue when referencing that component.

Thank you! I tried the downgrade BarcodeScanner.Mobile.Maui to version 8.0.0.1, cleaned bin/obj , restated VS and the project. several times with no luck

this issue is related to BarcodeScanner.Mobile.Maui ANY version, I can not use them together. With/without other Barcode scanner nuggets - it works fine

this issue is related to BarcodeScanner.Mobile.Maui ANY version, I can not use them together. With/without other Barcode scanner nuggets - it works fine

This is likely because that BarcodeScanner library uses the MLKit components, but referenced from another custom library. I'm actually actively in the process of trying to get the MLKit BarcodeScanning library here enabled so I can fork that project and point it over here, rather than its own custom thing.

It's been ... challenging to be honest, can't get the stuff to build locally on my Mac due to some missing sub-components or whatnot. Removing Xamarin support and switching over to .NET 8 seems to help, but I'm still only a couple hours into the investigation.

this issue is related to BarcodeScanner.Mobile.Maui ANY version, I can not use them together. With/without other Barcode scanner nuggets - it works fine

This is likely because that BarcodeScanner library uses the MLKit components, but referenced from another custom library. I'm actually actively in the process of trying to get the MLKit BarcodeScanning library here enabled so I can fork that project and point it over here, rather than its own custom thing.

It's been ... challenging to be honest, can't get the stuff to build locally on my Mac due to some missing sub-components or whatnot. Removing Xamarin support and switching over to .NET 8 seems to help, but I'm still only a couple hours into the investigation.

yeah, this library BarcodeScanner.Mobile.Mau pretty fast and works perfectly for me! this one ZXing.Net.Maui much more slower

This is likely because that BarcodeScanner library uses the MLKit components, but referenced from another custom library. I'm actually actively in the process of trying to get the MLKit BarcodeScanning library here enabled so I can fork that project and point it over here, rather than its own custom thing.

It's been ... challenging to be honest, can't get the stuff to build locally on my Mac due to some missing sub-components or whatnot. Removing Xamarin support and switching over to .NET 8 seems to help, but I'm still only a couple hours into the investigation.

Hi! Have you resolved this issue? Or did you just take another scanner lib?

The native Firebase and MLKit SDK libraries have some shared native dependencies:

  • GTMSessionFetcher
  • GoogleDataTransport
  • GoogleUtilities
  • PromisesObjC
  • nanopb

This means that Nuget packages shipping MLKit or Firebase bindings either need to 1) include .xcframeworks for each of these libraries or 2) reference a package that includes these xcframeworks.

The problem with approach (1) is that if there is an intersection between the .xcframeworks included in two Nugets, then the packages will be incompatible with each other.

The problem with approach (2) is that there is no longer a central authority that should be trusted to publish and maintain these common dependencies. Historically this was handled by Xamarin, but that is no longer the case.

I don't know how that scanner library gets these shared dependencies, but unless both projects agree on the source, then they'll likely stay incompatible with each other.

@IrynaDoroshenkoDev - the latest 8.0.40.1 version of BarcodeScanner.Mobile.Maui should be working with the support of the libraries here.

@IrynaDoroshenkoDev - the latest 8.0.40.1 version of BarcodeScanner.Mobile.Maui should be working with the support of the libraries here.

Thank you so much!