xamarin / GoogleApisForiOSComponents

MIT License
225 stars 162 forks source link

Native linking failed #158

Closed felipecds closed 5 years ago

felipecds commented 6 years ago

I'm getting this log during build:

Undefined symbols for architecture arm64: "_FIRLogBasic", referenced from: -[FIRInstanceIDLogger logFuncDebug:messageCode:msg:] in FirebaseInstanceID(FIRInstanceIDLogger_0c879e312576b1b79740d2f19907597f.o) -[FIRInstanceIDLogger logFuncInfo:messageCode:msg:] in FirebaseInstanceID(FIRInstanceIDLogger_0c879e312576b1b79740d2f19907597f.o) -[FIRInstanceIDLogger logFuncNotice:messageCode:msg:] in FirebaseInstanceID(FIRInstanceIDLogger_0c879e312576b1b79740d2f19907597f.o) -[FIRInstanceIDLogger logFuncWarning:messageCode:msg:] in FirebaseInstanceID(FIRInstanceIDLogger_0c879e312576b1b79740d2f19907597f.o) -[FIRInstanceIDLogger logFuncError:messageCode:msg:] in FirebaseInstanceID(FIRInstanceIDLogger_0c879e312576b1b79740d2f19907597f.o) ld: symbol(s) not found for architecture arm64 clang : error : linker command failed with exit code 1 (use -v to see invocation)

MTOUCH : error MT5210: Native linking failed, undefined symbol: _FIRLogBasic. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -L../../Dll -lrealm-wrappers -L/Users/dsv/cds/phideliscast/V3.0-Apps/PhidelisCast.Droid/packages/Realm.3.0.0/build/../native/ios/universal -lrealm-wrappers -lz -framework Security MTOUCH : error MT5202: Native linking failed. Please review the build log.

I'm using the latest version of XCode, NuGet packages (2.0.8.1) and Visual Studio for Mac

Edit:--------------

With this packages, there are no issues:

InstanceID 2.0.0 Analytics 4.0.2 Core 4.0.8 CloudMessaging 2.0.4

VS bug #732438

ghost commented 5 years ago

I have a similar issue with google maps. MTOUCH : warning MT1302: Could not extract the native library 'GoogleMaps'

we downloaded and modified the source code directly from https://github.com/amay077/Xamarin.Forms.GoogleMaps

We didn't package it with nuget. We included the project files in our solution

fl034 commented 5 years ago

If you are not using Firebase Core, but you have the NuGet referenced, please, add this line anywhere in your app and let me know if this "fixes" the build errors.

var foo = Firebase.Core.Configuration.SharedInstance;

@SotoiGhost this helped, thanks. I was testing with a fresh iOS only project, using MLKit via nuget.

dsancho commented 5 years ago

I'm using VS2019 16.0.3 and have the same problem using xamarin.firebase.ios.admob latest version (7.38.0). I have done try and error and found that with version 7.27.0.3 my app links fine. It fails linking from version 7.31. I'm using VS for windows.

spaki commented 5 years ago

I was able to solve some of these problems adding this nuget package: https://www.nuget.org/packages/Xamarin.Google.iOS.SignIn/

VansW commented 5 years ago

I had native linking issues because my app was using another plugin called plugin.FirebasePushNotification and this plugin was adding Firebase.Messaging 2.0.8 nuget package which was causing native linking issue. So I added the latest version of Firebase.Messaging nuget package and that resolved my issue.

lngka commented 5 years ago

I had native linking issues because my app was using another plugin called plugin.FirebasePushNotification and this plugin was adding Firebase.Messaging 2.0.8 nuget package which was causing native linking issue. So I added the latest version of Firebase.Messaging nuget package and that resolved my issue.

In my case the plugin.FirebasePushNotification implicitly installed Firebase.Core in my solution. My issue was resolved when I removed the explicit Firebase.Core from my project

randomroxks commented 4 years ago

Does anyone need a sample project? This is happening again.

AyonGupta commented 4 years ago

Native linking failed, undefined symbol: ___darwin_check_fd_set_overflow. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in

Please help

blmiles commented 4 years ago

For those interested, I have the latest VS 2019 version (16.5.4), the latest XCode version (11.4.1) with iOS versions too. Building a Xamarin.Forms project, targeting Android and iOS.

If I include the latest Xamarin.Google.iOS.MobileAds (7.57.0) along with required dependencies (Firebase), I get this "failed to resolve ObjCRuntime.TrampolineBlockBase" too, along with 47 other build/compile errors for iOS.

If I exclude those plugin libraries, my iOS app compiles and runs just fine.

No build errors for Android.

It would be great to know what versions of these relevant plugins to include so that all is compatible with the other AND with the latest mono framework!

Someone building Xamarin.Google.iOS.MobileAds & the related firebase plugins dropped the ball.

SOMEONE NEEDS TO REOPEN THIS!

blmiles commented 4 years ago

Does anyone need a sample project? This is happening again.

YES, as some samples out there are citing obsolete methods and there does not seem to be much guidance on WHAT versions of these plugins to include that are all compatible and actually work!

bondarenkod commented 4 years ago

Hi! I have the same error in my project but with the latest version of Xamarin.Firebase.iOS.Analytics. The previous (in my other project) version is compiling fine.

Xamarin.Firebase.iOS.Analytics 5.5.0 VS build & VSTS build - OK

Xamarin.Firebase.iOS.Analytics 6.4.1 VS build & VSTS build - FAIL VS log output:

Native linking failed, undefined Objective-C class: FIRInstallations. The symbol '_OBJC_CLASS_$_FIRInstallations' could not be found in any of the libraries or frameworks linked with your application.            

Native linking failed. Please review the build log and the user flags provided to gcc: -LC:/Users/bonda/AppData/Local/XamarinBuildDownloadCache/GAnlytcs-3.17/Libraries -lGoogleAnalytics -force_load C:/Users/bonda/AppData/Local/XamarinBuildDownloadCache/GAnlytcs-3.17/Libraries/libGoogleAnalytics.a -ObjC -lz -lsqlite3 -LC:/Users/bonda/.nuget/packages/realm/3.3.0/build/../native/ios/universal -lrealm-wrappers -lz -framework Security -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/user/Library/Caches/Xamarin/mtbs/builds/PROJECT_NAME.iOS/90b8cb5289438ac1739e0508c9a6df6d/obj/iPhoneSimulator/Debug/Entitlements.xcent       

Native linking failed, undefined symbol: _FIRInstallationIDDidChangeNotification. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.     

linker command failed with exit code 1 (use -v to see invocation)       

Also there is a difference in connected libraries to the project (needs to restart vs to see the changes after installing new or old version of the lib) image

ping me if you need additional info.

tstpierre commented 4 years ago

Hi! I have the same error in my project but with the latest version of Xamarin.Firebase.iOS.Analytics. The previous (in my other project) version is compiling fine.

Xamarin.Firebase.iOS.Analytics 5.5.0 VS build & VSTS build - OK

Xamarin.Firebase.iOS.Analytics 6.4.1 VS build & VSTS build - FAIL VS log output:

Native linking failed, undefined Objective-C class: FIRInstallations. The symbol '_OBJC_CLASS_$_FIRInstallations' could not be found in any of the libraries or frameworks linked with your application.          

Native linking failed. Please review the build log and the user flags provided to gcc: -LC:/Users/bonda/AppData/Local/XamarinBuildDownloadCache/GAnlytcs-3.17/Libraries -lGoogleAnalytics -force_load C:/Users/bonda/AppData/Local/XamarinBuildDownloadCache/GAnlytcs-3.17/Libraries/libGoogleAnalytics.a -ObjC -lz -lsqlite3 -LC:/Users/bonda/.nuget/packages/realm/3.3.0/build/../native/ios/universal -lrealm-wrappers -lz -framework Security -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/user/Library/Caches/Xamarin/mtbs/builds/PROJECT_NAME.iOS/90b8cb5289438ac1739e0508c9a6df6d/obj/iPhoneSimulator/Debug/Entitlements.xcent     

Native linking failed, undefined symbol: _FIRInstallationIDDidChangeNotification. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.       

linker command failed with exit code 1 (use -v to see invocation)     

Also there is a difference in connected libraries to the project (needs to restart vs to see the changes after installing new or old version of the lib) image

ping me if you need additional info.

Same issue. If I downgrade Xamarin.Firebase.iOS.Analytics to 6.2.1 the build succeeds.

ithiredguns commented 4 years ago

Hi! I have the same error in my project but with the latest version of Xamarin.Firebase.iOS.Analytics. The previous (in my other project) version is compiling fine. Xamarin.Firebase.iOS.Analytics 5.5.0 VS build & VSTS build - OK Xamarin.Firebase.iOS.Analytics 6.4.1 VS build & VSTS build - FAIL VS log output:

Native linking failed, undefined Objective-C class: FIRInstallations. The symbol '_OBJC_CLASS_$_FIRInstallations' could not be found in any of the libraries or frameworks linked with your application.            

Native linking failed. Please review the build log and the user flags provided to gcc: -LC:/Users/bonda/AppData/Local/XamarinBuildDownloadCache/GAnlytcs-3.17/Libraries -lGoogleAnalytics -force_load C:/Users/bonda/AppData/Local/XamarinBuildDownloadCache/GAnlytcs-3.17/Libraries/libGoogleAnalytics.a -ObjC -lz -lsqlite3 -LC:/Users/bonda/.nuget/packages/realm/3.3.0/build/../native/ios/universal -lrealm-wrappers -lz -framework Security -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/user/Library/Caches/Xamarin/mtbs/builds/PROJECT_NAME.iOS/90b8cb5289438ac1739e0508c9a6df6d/obj/iPhoneSimulator/Debug/Entitlements.xcent       

Native linking failed, undefined symbol: _FIRInstallationIDDidChangeNotification. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.     

linker command failed with exit code 1 (use -v to see invocation)       

Also there is a difference in connected libraries to the project (needs to restart vs to see the changes after installing new or old version of the lib) image ping me if you need additional info.

Same issue. If I downgrade Xamarin.Firebase.iOS.Analytics to 6.2.1 the build succeeds.

This works !!!!!!!!!!!!

olowoshiai commented 4 years ago

Hi! I've tried the solutions listed under this thread to fix my errors but none has worked for me: (Downgraded Xamarin.Firebase.iOS.Analytics to 6.2.1, deleted bin & obj folders, deleted xamarinbuilddownload folder under library/caches, added --registrar:static to mtouch args). The error is still persistent, I'll appreciate anymore leads that I can get. Thanks!!

Screen Shot 2020-05-28 at 1 34 40 PM
bondarenkod commented 4 years ago

@olowoshiai try 5.5.0

olowoshiai commented 4 years ago

5.5.0 didn't fix the errors, unfortunately. Any more leads will be appreciated

chamons commented 4 years ago

Please open a new issue with detailed build logs and a sample showing the problem, not commenting here.

taddisateesh commented 4 years ago

I am facing same issue with latest package. Any workaround for this issue ?

whitneyschmidt commented 4 years ago

@taddisateesh Could you open a new issue with detailed build logs and a small sample that reproduces the problem?

To get full build logs just set the log verbosity to diagnostic at the following locations:

On Visual Studio for Windows you also want to add -v -v -v -v to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting Properties.

Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

The easiest way to get exact version information:

Then copy/paste the version information (you can use the "Copy Information" button).

olowoshiai commented 4 years ago

I fixed my errors so I'm not gonna create a new issue. @taddisateesh I fixed this error by making one of my team members pull the project on their computer and applying all the solutions I listed in my question all at once(so I'm not sure what in particular made the errors go away). Although, I would note that I also downgraded Xamarin.Build.Download Package from 0.10.0 to 0.4.11, perhaps try this step too.

tallmanBS commented 4 years ago

This page helped me resolve the Native Linking so just to share, I converted my project to packagereference (where to hold Nuget info). When I did that for some reason some of the items didn't get entered into the project properly and it wasnt obvious. After looking at this post and comparing package.config with project, found the Firebase>IOS.CORE and Firebase.IOS.InstanceID didn't transfer. Installed them and the native linking errors went away.

Axemasta commented 2 years ago

I know this issue is closed but for any poor soul working in this area, I came across a variety of these issues when working with this library & i thought I'd share what fixed for me:

Environment

Expand to see
=== Visual Studio Community 2019 for Mac ===

Version 8.10.16 (build 2)
Installation UUID: f7f72c9b-58a7-43ec-93db-5828dee614d2
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000162

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.162 (2020-02/2ca650f1f62) (64-bit)
    Package version: 612000162

=== Roslyn (Language Service) ===

3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb

=== NuGet ===

Version: 5.9.0.7134

=== .NET SDK (x64) ===

SDK: /usr/local/share/dotnet/sdk/6.0.101/Sdks
SDK Versions:
    6.0.101
    6.0.100
    5.0.404
    5.0.403
    5.0.402
    5.0.401
    5.0.400
    5.0.302
    5.0.301
    5.0.203
    5.0.202
    5.0.201
    5.0.103
    5.0.102
    5.0.101
    5.0.100
    3.1.416
    3.1.415
    3.1.414
    3.1.413
    3.1.412
    3.1.411
    3.1.410
    3.1.409
    3.1.408
    3.1.407
    3.1.406
    3.1.405
    3.1.404
    3.1.403
    3.1.300
    3.1.201
    2.1.202
    2.0.0
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    6.0.1
    6.0.0
    5.0.13
    5.0.12
    5.0.11
    5.0.10
    5.0.9
    5.0.8
    5.0.7
    5.0.6
    5.0.5
    5.0.4
    5.0.3
    5.0.2
    5.0.1
    5.0.0
    3.1.22
    3.1.21
    3.1.20
    3.1.19
    3.1.18
    3.1.17
    3.1.16
    3.1.15
    3.1.14
    3.1.13
    3.1.12
    3.1.11
    3.1.10
    3.1.9
    3.1.4
    3.1.3
    2.1.23
    2.0.9
    2.0.0

=== .NET Core 3.1 SDK ===

SDK: 3.1.416

=== .NET 5.0 SDK ===

SDK: 5.0.404

=== Xamarin.Profiler ===

Version: 1.7.0.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 13.2.1 (19586)
Build 13C100

=== Xamarin.Mac ===

Version: 8.4.0.0 (Visual Studio Community)
Hash: 8fc41ae82
Branch: xcode13.2
Build date: 2021-12-09 01:07:56-0500

=== Xamarin.iOS ===

Version: 15.4.0.0 (Visual Studio Community)
Hash: 8fc41ae82
Branch: xcode13.2
Build date: 2021-12-09 01:07:56-0500

=== Xamarin Designer ===

Version: 16.11.0.39
Hash: cd672761d
Branch: remotes/origin/d16-11
Build date: 2021-10-06 21:09:18 UTC

=== Xamarin.Android ===

Version: 12.0.0.3 (Visual Studio Community)
Commit: xamarin-android/d16-11/f0e3c2d
Android SDK: /Users/alex.duffell/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 30.0.2

Build Information: 
Mono: c633fe9
Java.Interop: xamarin/java.interop/d16-11@476bb5b
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.35.4@85460d3
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@87af37b

=== Eclipse Temurin JDK ===

Java SDK: Not Found

=== Android SDK Manager ===

Version: 16.10.0.13
Hash: 1b81df5
Branch: remotes/origin/d16-10
Build date: 2021-11-12 01:17:32 UTC

=== Android Device Manager ===

Version: 16.10.0.15
Hash: 89dcc0b
Branch: remotes/origin/d16-10
Build date: 2021-11-12 01:17:52 UTC

=== Build Information ===

Release ID: 810160002
Git revision: 6dbc7886fa608147f685a7df3912249400c84716
Build date: 2021-12-14 15:54:37-05
Build branch: release-8.10

=== Operating System ===

Mac OS X 11.4.0
Darwin 20.5.0 Darwin Kernel Version 20.5.0
    Sat May  8 05:10:33 PDT 2021
    root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

DeepClean 1.2.5
Code Distribution Extension 1.1
LightSwitch 💡 1.0
Code Coverage 2.0.1

Packages

<PackageReference Include="Xamarin.Firebase.iOS.Core" Version="6.10.4" />
<PackageReference Include="Xamarin.Firebase.iOS.MLKit.Vision" Version="0.21.0" />

Build Errors

With the firebase init code in iOS AppDelegate:

Firebase.Core.App.Configure();

I was getting build errors on simulator & warnings on physical device:

Simulator Errors:

/Users/axemasta/Documents/FaceDetectionPOC/samples/FaceDetection.Sample.iOS/error MT5209: Error: warning: object file (/Users/axemasta/Library/Caches/XamarinBuildDownload/FMLVsnA-0.21.0/Frameworks/FirebaseMLVisionAutoML.framework/FirebaseMLVisionAutoML(FIRVisionOnDeviceAutoMLImageLabeler_9a4fa7b794cb4743ee6c3583f60d8f42.o)) was built for newer iOS Simulator version (9.0) than being linked (8.0) (FaceDetection.Sample.iOS) Native linking

Physical Warnings:

/Users/axemasta/Documents/FaceDetectionPOC/samples/FaceDetection.Sample.iOS/warning MT5203: Warning: warning: object file (/Users/axemasta/Library/Caches/XamarinBuildDownload/TnsrFlwLtC-2.3.0/TensorFlowLiteC-2.3.0/Frameworks/TensorFlowLiteC.framework/TensorFlowLiteC) was built for newer iOS version (9.0) than being linked (8.0) (FaceDetection.Sample.iOS) Native linking

After a while of not being able to build I fixed the solution by changing an 8 to a 10...

The newer packages have higher minimum iOS versions so make sure you target iOS10 as the minimum in your info.plist:

<key>MinimumOSVersion</key>
<string>10.0</string>

No linker config required, my project now builds and runs on iOS for simulators & physical devices no problemo 🥳