TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
211 stars 49 forks source link

Error: clang++ exited with code 1 #281

Closed Hardikzinzala closed 3 months ago

Hardikzinzala commented 6 months ago

When I run this app on emulator that works fine but try on realdevice that time that not install and give me this error so how to solve this error

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7133/targets/Xamarin.Shared.Sdk.targets(3,3): Error: clang++ exited with code 1:
Undefined symbols for architecture arm64:
  "_objc_msgSend$initWithProtocol:isRequired:", referenced from:
      +[GULCCDependency dependencyWithProtocol:] in GoogleUtilitiesComponents(GULCCDependency.o)
      +[GULCCDependency dependencyWithProtocol:isRequired:] in GoogleUtilitiesComponents(GULCCDependency.o)
  "_objc_msgSend$allValues", referenced from:
      -[GULCCComponentContainer removeAllCachedInstances] in GoogleUtilitiesComponents(GULCCComponentContainer.o)
  "_objc_msgSend$respondsToSelector:", referenced from:
      -[GULCCComponentContainer removeAllCachedInstances] in GoogleUtilitiesComponents(GULCCComponentContainer.o)
  "_objc_msgSend$removeAllObjects", referenced from:
      -[GULCCComponentContainer removeAllCachedInstances] in GoogleUtilitiesComponents(GULCCComponentContainer.o)
  "_objc_msgSend$conformsToProtocol:", referenced from:
      -[GULCCComponentContainer instantiateInstanceForProtocol:withBlock:] in GoogleUtilitiesComponents(GULCCComponentContainer.o)
      -[GULCCComponentContai (TM)

I am trying this .Net 7 and .Net 8 on Mac Sonoma

TobiasBuchholz commented 6 months ago

Hi, could you please provide a sample project that demonstrates this issue? Thanks!

thordu25 commented 4 months ago

I Have a same Issue Create a Projet Maui IOS17.4 on Visual studio 2022 Pair to a mac with xcode15.2 compile and you get this error clang++ a quitté avec le code 1: ld: warning: Could not find or use auto-linked framework 'GoogleAppMeasurement' Undefined symbols for architecture arm64:

softeip commented 4 months ago

Downgrade to Plugin.Firebase 2.0.12 works for me

<PackageReference Include="Plugin.Firebase" Version="2.0.12" />
katkusmt commented 3 months ago

Had the same clang error with Plugin.Firebase.Analytics, had to downgrade to 2.0.2 for our project to compile.

AlexanderVanMeerten commented 3 months ago

Same here.

metzel93 commented 3 months ago

Same here

AdamEssenmacher commented 3 months ago

A repro sample would be helpful

msuddaby commented 3 months ago

@AdamEssenmacher Having the same issue. Here's my .csproj, if that helps.

<Project Sdk="Microsoft.NET.Sdk.Razor">
    <Target Name="LinkWithSwift" DependsOnTargets="_ParseBundlerArguments;_DetectSdkLocations" BeforeTargets="_LinkNativeExecutable">
        <PropertyGroup>
            <_SwiftPlatform Condition="$(RuntimeIdentifier.StartsWith('iossimulator-'))">iphonesimulator</_SwiftPlatform>
            <_SwiftPlatform Condition="$(RuntimeIdentifier.StartsWith('ios-'))">iphoneos</_SwiftPlatform>
        </PropertyGroup>
        <ItemGroup>
            <_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" />
        </ItemGroup>
    </Target>

    <PropertyGroup>
        <TargetFrameworks>net8.0-ios;</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
        <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
        <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

        <!-- Note for MacCatalyst:
            The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
            When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
            The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
            either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
        <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

        <OutputType>Exe</OutputType>
        <RootNamespace>TeamApp</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>
        <EnableDefaultCssItems>false</EnableDefaultCssItems>
        <Nullable>enable</Nullable>

        <!-- Display name -->
        <ApplicationTitle>TeamApp</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.mdev.teamtwo</ApplicationId>

        <!-- Versions -->
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
    </PropertyGroup>

    <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4"/>

        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128"/>

        <!-- Images -->
        <MauiImage Include="Resources\Images\*"/>
        <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208"/>

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*"/>

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/>
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="AdamE.Firebase.iOS.Analytics" Version="10.24.0.2" />
        <PackageReference Include="AdamE.Firebase.iOS.CloudMessaging" Version="10.24.0.2" />
        <PackageReference Include="AdamE.Firebase.iOS.Core" Version="10.24.0.2" />
        <PackageReference Include="AdamE.Firebase.iOS.Crashlytics" Version="10.24.0.2" />
        <PackageReference Include="AdamE.Firebase.iOS.Installations" Version="10.24.0.2" />
        <PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.6" />
        <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
        <PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
        <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
        <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.40" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0"/>
        <PackageReference Include="MudBlazor" Version="6.20.0" />
        <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
        <PackageReference Include="Plugin.Firebase" Version="3.0.0" />
        <PackageReference Include="Scrutor" Version="4.2.2" />
        <PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
        <PackageReference Include="System.Net.Http" Version="4.3.4" />
    </ItemGroup>

    <PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
        <_ExportSymbolsExplicitly>false</_ExportSymbolsExplicitly>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
        <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
    </PropertyGroup>

    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
      <CodesignKey>Apple Development: x (xxx)</CodesignKey>
    </PropertyGroup>

    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
        <PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.0.3" />
        <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.0.2" />
        <GoogleServicesJson Include="Platforms\Android\google-services.json" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
        <GoogleServiceJson Include="Platforms/iOS/GoogleService-Info.plist" />
    </ItemGroup>

    <ItemGroup>
      <Reference Include="Mono.Android">
        <HintPath>..\..\..\..\..\Program Files\dotnet\packs\Microsoft.Android.Ref.34\34.0.43\ref\net8.0\Mono.Android.dll</HintPath>
      </Reference>
    </ItemGroup>

    <ItemGroup>
      <Content Remove="Platforms\Android\google-services.json" />
      <None Include="Platforms\Android\google-services.json" />
    </ItemGroup>

</Project>

builds fine on Android. I'm now trying to get it building on iOS with no luck.

AdamEssenmacher commented 3 months ago

I experienced no problems building and deploying a blank MAUI Blazor hybrid app with @msuddaby 's project file.

Can anyone experiencing this issue post a minimal (but actual) repro project?

msuddaby commented 3 months ago

@AdamEssenmacher

I experienced no problems building and deploying a blank MAUI Blazor hybrid app with @msuddaby 's project file.

Can anyone experiencing this issue post a minimal (but actual) repro project?

https://github.com/msuddaby/MauiPluginTest

Just got home. Created a blank MAUI Blazor Hybrid app in JetBrains Rider 2024.1.2. Copied the contents of my other project's csproj into this app, and added the required Entitlements.plist into the iOS folder.

I am running this on macOS Sonoma (14.5).

I attempted to build the project for an iOS simulator running 17.0 and 17.5 (both iPhone 15.)

I have attached the error log as well in the README.md. Hopefully this helps.

AdamEssenmacher commented 3 months ago

@msuddaby it's building and deploying to an iOS 17.5 simulator just fine for me. My setup:

In AdamE.Firebase.iOS.Core, GoogleAppMeasurement is unique in that it is the only dependency not packed directly into the nuget package. Instead, it is downloaded as part of the build by Xamarin.Build.Download. You should see logs like:

Target _XamarinBuildDownloadCore:
  Downloading https://dl.google.com/firebase/ios/analytics/cc4d75392af34c62/GoogleAppMeasurement-10.24.0.tar.gz to /Users/adam/Library/Caches/XamarinBuildDownload/GAppM-10.24.0.tgz
    (3615/10040163b), total 0.0%
    (1014018/10040163b), total 10.0%
    (2015232/10040163b), total 20.0%
    (3014640/10040163b), total 30.0%
    (4030448/10040163b), total 40.0%
    (5029856/10040163b), total 50.0%
    (6029280/10040163b), total 60.0%
    (7028688/10040163b), total 70.0%
    (8044496/10040163b), total 80.0%
    (9043904/10040163b), total 90.0%
    (10040163/10040163b), total 100.0%
  Downloading Complete
Extracting /Users/adam/Library/Caches/XamarinBuildDownload/GAppM-10.24.0.tgz to /Users/adam/Library/Caches/XamarinBuildDownload/GAppM-10.24.0

If you don't see this in your build log, it's pulling from the cache (e.g. /Users/adam/Library/Caches/XamarinBuildDownload/GAppM-10.24.0)

If your cache doesn't look like this, then that's what's wrong. Delete the XamarinBuildDownload directory and try running your build again.

image

msuddaby commented 3 months ago

@AdamEssenmacher now it builds! Thank you!

lhughey commented 3 months ago

I don't know why I can't get past this issue. My GAppM-10.24.0 folder looks identical. I've deleted it, cleaned my folder and attempted to deploy multiple times with no luck.

I'm using the following setup (which is very similar to @AdamEssenmacher 's setup) Rider 2024.1.3 M1 Mac / Sonoma 14.5 XCode 15.4 dotnet 8.0.300

msuddaby commented 3 months ago

I don't know why I can't get past this issue. My GAppM-10.24.0 folder looks identical. I've deleted it, cleaned my folder and attempted to deploy multiple times with no luck.

I'm using the following setup (which is very similar to @AdamEssenmacher 's setup)

Rider 2024.1.3

M1 Mac / Sonoma 14.5

XCode 15.4

dotnet 8.0.300

You probably don't want to hear this, but I just moved my apps to Flutter. Microsoft abandoning a (arguably) necessary plugin shows how horrible the state of MAUI is. I really don't want to be anywhere near it anymore.

lhughey commented 3 months ago

I don't know why I can't get past this issue. My GAppM-10.24.0 folder looks identical. I've deleted it, cleaned my folder and attempted to deploy multiple times with no luck. I'm using the following setup (which is very similar to @AdamEssenmacher 's setup) Rider 2024.1.3 M1 Mac / Sonoma 14.5 XCode 15.4 dotnet 8.0.300

You probably don't want to hear this, but I just moved my apps to Flutter. Microsoft abandoning a (arguably) necessary plugin shows how horrible the state of MAUI is. I really don't want to be anywhere near it anymore.

I'm not mad at you. MS suggest that we move from AppCenter to Firebase, but then don't support the migration. It's frustrating.

I think I'm dealing with a "/dotnet/x64" install vs a "/dotnet/dotnet" issue on mac, so I'll reserve my fussing until I determine the source of my issue.

AdamEssenmacher commented 3 months ago

@lhughey there are more than one actual issues discussed in this thread, so it's hard to tell which one we're actually discussing. Please open a separate issue detailing your problem and include the build / error message(s) you're seeing.