Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

iOS: Native linking error in fresh installation

pelisterpelister USMember ✭✭

Recently I moved my project to a fresh installation of macOS. I installed Xcode, Visual Studio Mac and Xamarin.iOS, then I retrieved the last build of the project from git server. My configuration is as follows:

  • macOS Mojave 10.14
  • Xcode 10.1
  • Visual Studio for Mac 7.6
  • Xamarin.iOS 12.2

My problem is that the project no longer builds. I keep getting native linking errors, the build output can be seen below:

/Users/u/Projects/appname/clang: Error: linker command failed with exit code 1 (use -v to see invocation) (prj)
/Users/u/Projects/appname/error MT5209: Error: warning: directory not found for option '-FFInstncID-3.2.1/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: warning: directory not found for option '-FFAnlytcs-5.1.4/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: warning: directory not found for option '-FFAnlytcs-5.1.4/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: warning: directory not found for option '-FGAppM-5.1.4/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: framework not found FirebaseInstanceID (prj) Native linking
/Users/u/Projects/appname/MTOUCH: Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz (MT5201) (prj)
/Users/u/Projects/appname/MTOUCH: Error MT5202: Native linking failed. Please review the build log. (MT5202) (prj)

Deleting obj and bin folders then rebuilding won't help. The problem seems to be related to Firebase packages, but I cannot figure out how. Do you have any suggestions?

Answers

  • SmartManSmartMan INMember ✭✭✭
    edited November 2018

    Did you change the Link behaviour to Link Framework sdks only in Project properties ??

  • pelisterpelister USMember ✭✭

    Forgot to mention, Link Framework SDKs was the existing option in my first trials and it failed. Trying Link All and Link None didn't help either. @SmartMan

  • pelisterpelister USMember ✭✭

    @SmartMan Now I tried --registrar:dynamic and -gcc_flags -dead_strip, the same error :(

  • SmartManSmartMan INMember ✭✭✭
    edited November 2018

    Deleting the bin and obj in both windows and mac and Restart the both..Sometime it may work.

    But this is not a good way to solve this problem

    or else update all the things

  • PaulNPaulN USMember ✭✭

    I Have similar errors:
    clang : error : linker command failed with exit code 1 (use -v to see invocation)
    error MT5209 : Native linking error : warning: directory not found for option '-FFInstncID-3.2.1/Frameworks'
    error MT5209 : Native linking error : warning: directory not found for option '-FFAnlytcs-5.1.4/Frameworks'
    error MT5209 : Native linking error : warning: directory not found for option '-FFAnlytcs-5.1.4/Frameworks'
    error MT5209 : Native linking error : warning: directory not found for option '-FGAppM-5.1.4/Frameworks'
    error MT5209 : Native linking error : warning: directory not found for option '-FFCrshlytcs-3.10.9/iOS'
    error MT5209 : Native linking error : warning: directory not found for option '-FFbrc-1.7.13/iOS'
    error MT5209 : Native linking error : framework not found FirebaseInstanceID
    MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lz -ObjC -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/admin/Projects/MyProjName/src/iOS/obj/iPhoneSimulator/Debug/device-builds/iphone11.4-12.1/Entitlements.xcent
    MTOUCH : error MT5202: Native linking failed. Please review the build log.

    Any ideas?

  • @SmartMan any update?

  • PaulNPaulN USMember ✭✭

    If you are keep facing with that mysterious bugs, try:
    1. Update packages to the latest version
    2. Check your csproj files. "<Import Project="..\packages\blah\blah.targets"" -- this should match actual nuget versions. If not -- fix that.
    3. Force reinstall all nuget packages.
    4. Manually remove bin/obj directories.
    Cross your fingers and try to build.

  • MazidiMazidi Member ✭✭

    After I installed visual studio 2019, it asked to install updated package of xcode while pairing, similar issue occurred of failing linker I tried deleting bin, obj, XamarinBuildDownloadCache, then clean and rebuild but without effect. I know that nothing in code changed to cause this errors.

    The solution was to delete the cached build files in the mac
    by open Finder then in top left select preferences check the box of side bar mac user name (icon like home)
    then in Finder select it from the side bar and navigate to yourProject.ios and delete the folder

    in mac pc:
    yourMacUser/Library/Caches/Xamarin/mtbs/builds and delete yourProject.ios

  • MazidiMazidi Member ✭✭
    edited July 2019

    So that broke also without any benefit almost immediatly,

    **Solution: ** after about around 15 hours of work between three days of trying almost everything, I realized that I commented the line of using appcenter in pcl project but I forgot that I still initialize it in AppDelegate of ios project
    like this
    Distribute.DontCheckForUpdatesInDebug();

    which was causing 8 failed linking errors, so then I commented this line and WALAAAH Its back, crazy world

  • AndreaSabbatiniAndreaSabbatini ITMember ✭✭

    @Mazidi said:
    After I installed visual studio 2019, it asked to install updated package of xcode while pairing, similar issue occurred of failing linker I tried deleting bin, obj, XamarinBuildDownloadCache, then clean and rebuild but without effect. I know that nothing in code changed to cause this errors.

    The solution was to delete the cached build files in the mac
    by open Finder then in top left select preferences check the box of side bar mac user name (icon like home)
    then in Finder select it from the side bar and navigate to yourProject.ios and delete the folder

    in mac pc:
    yourMacUser/Library/Caches/Xamarin/mtbs/builds and delete yourProject.ios

    This worked for one project, but not for a similar one, same packages. Weird...

  • BrianAdamsBrianAdams Member ✭✭

    Happy 2020! I'm having the same issue! On older installs the app build but on a new Mac with VS 2019 this doesn't build. It errors and says I dont have GoogleMaps installed. My issue is that the directory shown above doesn't exist:
    yourMacUser/Library/Caches/Xamarin/mtbs/builds .
    There is no Xamarin folder, where did they move it to???
    thanks,
    Brian

Sign In or Register to comment.