Native linking failed xamarin ios in visual studio mac - xamarin

While I am running my xamarin forms ios project to mac,its showing native linking error:
Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -ObjC -ObjC -lc++ -lz -ObjC -lc++ -lsqlite3 -lz (MT5201)
How to solve this issue?

Possible solutions:
Update Xamarin.Build.Download to the latest version.
Are there any other errors or only this one? It might be you need to update other libraries (in my case it was google/firebase libs) (and clean bin/obj and package folders of course :) )

Related

How to fix "Native linking failed..." errors when installing Xamarin.Firebase.iOS.MLKit in Xamarin.Ios

I have created a new Xamarin Forms (v3.6) project and installed the Xamarin.Firebase.iOS.MLKit nuget.
After compiling the project, I get lots of errors like this:
Native linking failed, undefined Objective-C class: GTLRVision_DetectedBreak. The symbol '_OBJC_CLASS_$_GTLRVision_DetectedBreak' could not be found in any of the libraries or frameworks linked with your application
Native linking failed, undefined Objective-C class: GTMLogMininumLevelFilter. The symbol '_OBJC_CLASS_$_GTMLogMininumLevelFilter' could not be found in any of the libraries or frameworks linked with your application
Native linking failed, undefined Objective-C class: FIRApp. The symbol '_OBJC_CLASS_$_FIRApp' could not be found in any of the libraries or frameworks linked with your application
Native linking failed, undefined symbol: _OBJC_METACLASS_$_GPBRootObject. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in
Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lc++ -lsqlite3 -lz -ObjC -ObjC -ObjC -ObjC -ObjC -ObjC -ObjC -lc++ -ObjC -lc++ -ObjC -lc++ -ObjC -lc++
Until now, I tried the following:
Delete bin/obj folders, clean and recompile the project
Re-install the nuget
Update xCode to the latest version
Change linking behaviors in the iOS project.
Added "--registrar:static" inside the Additional mtouch arguments inside de iOS Build configuration.
None of them worked.
Is there any solution out there?
Make sure you have initialized Firebase after you installed Xamarin.Firebase.iOS.MLKit in Xamarin.iOS.
Here is the code of initialization:
Firebase.Core.App.Configure ();
Refer: GoogleApisForiOSComponents

Error Creating Xcode projects for wxWidgets applications

I am trying to create an Xcode project with wxWidgets applications.
I follow the manual of wxwidgets:
....
-lz -stdlib=libstdc++ -lwx_osx_cocoa_static -Xlinker -dependency_info -Xlinker
....
ld: library not found for -lwx_osx_cocoa_static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea how to fix this?
If I look for the library the name is: "libwx_osx_cocoa_static.a"
Amazing! so simple: I added the library path (to libwx_osx_cocoa_static.a) and compilation succeeded! Add to Library search Pathes: $(WXROOT)/build/osx/build/Debug/

Cocoapods -lPods-{pod name} mach-o linker error

Using multiple schemes for build project, i'm getting this error across all scheme archiving processes:
Ld /Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/IntermediateBuildFilesPath/project.build/ReleaseProd-iphoneos/project.build/Objects-normal/arm64/project normal arm64
cd /Users/daniel.kim/Projects/7-11/project-ios-2-0
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/BuildProductsPath/ReleaseProd-iphoneos -L/Users/daniel.kim/Projects/7-11/project-ios-2-0/Pods/FlurrySDK/Flurry -F/Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/BuildProductsPath/ReleaseProd-iphoneos -filelist /Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/IntermediateBuildFilesPath/project.build/ReleaseProd-iphoneos/project.build/Objects-normal/arm64/project.LinkFileList -dead_strip -ObjC -lFlurry_5.4.0 -lPods-AFNetworking -lPods-AFOAuth2Client -lPods-AsyncImageView -lPods-Bugsnag -lPods-FXPageControl -lPods-FlurrySDK -lPods-ISO8601DateFormatter -lPods-MBProgressHUD -lPods-MMDrawerController -lPods-Mantle -lPods-RSBarcodes -lc++ -lz -framework AVFoundation -framework CoreGraphics -framework CoreImage -framework Foundation -framework MediaPlayer -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -weak_framework AdSupport -weak_framework StoreKit -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -force_load -Xlinker /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a -Xlinker -add_ast_path -Xlinker /Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/IntermediateBuildFilesPath/project.build/ReleaseProd-iphoneos/project.build/Objects-normal/arm64/project.swiftmodule -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -lPods -Xlinker -dependency_info -Xlinker /Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/IntermediateBuildFilesPath/project.build/ReleaseProd-iphoneos/project.build/Objects-normal/arm64/project_dependency_info.dat -o /Users/daniel.kim/Library/Developer/Xcode/DerivedData/project-dmzuaarzxovfpwglmdnamvbivecp/Build/Intermediates/ArchiveIntermediates/project-release-prod/IntermediateBuildFilesPath/project.build/ReleaseProd-iphoneos/project.build/Objects-normal/arm64/project
ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm using the xcworkspace, have tried a fresh pod install, have gem updated system as well as cocoapods, change associated values to $(inherited) in things such as the library search paths, checked the schemes to ensure that there were no extraneous processes for each and every scheme.
The schemes are only used to change environment variables for our test / production API servers when it's a debug versus release build.
Have tried changing every possible related setting in xcode that I could think of.
UPDATE: As a note, the first scheme doesn't fail when building, with is my debug-prod scheme. It archives and works successfully. There is some mention on the troubleshooting cocoapods page about only the first target being specific automatically by cocoapods and that link_with needs to be used to specify other targets, but all I have is 4 schemes and one target, not 4 targets...
What do i need to do to specify and direct cocoapods to those builds?
Under Edit Scheme -> Archive -> Archive -> Build Configuration, just need to set the proper configuration...
That solved the issue, they were all pointed to the wrong default Build Configs created by XCode Debug or Release....
Make sure your other imported xcode project implemented these custom schemes as well.
More information can be found in my post here:
Swift frameworks do not work with build configurations named other than 'Debug' or 'Release': No such module
I managed to get this working by making sure each scheme was visible (Product->Scheme->Manage Schemes->Tick 'Show' or each pod). Then I built each pod project individually.
After that I could build my project. I cannot explain why this worked.
I had the same issue and the problem was that I was opening the wrong file. Make sure you open your .xcworkspace file.

Xcode 6.1 & Cocoapods Integration/Dependency Error - library not found for -lPods-{Pod Name}

I just upgraded to OS 10.10 Yosemite and Xcode 6 and am having trouble getting my iOS app with CocoaPods dependencies to build.
After doing a clean and build I get an Apple Mac-O Linker Error as shown below
Ld /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator/ToWatchList.app/ToWatchList normal i386
cd "/Users/nick/Dropbox/ToWatchList/ToWatchList App"
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator -F/Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator -F/Users/nick/Dropbox/ToWatchList/ToWatchList\ App/Pods/CrashlyticsFramework -F/Users/nick/Dropbox/ToWatchList/ToWatchList\ App -filelist /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Intermediates/ToWatchList.build/Release-iphonesimulator/ToWatchList.build/Objects-normal/i386/ToWatchList.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-AFNetworking -lPods-AuxRepo -lPods-CrashlyticsFramework -lPods-Reachability -lPods-SSKeychain -lPods-SVProgressHUD -lPods-Tapstream -framework CoreGraphics -framework Crashlytics -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -lz -lPods -Xlinker -dependency_info -Xlinker /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Intermediates/ToWatchList.build/Release-iphonesimulator/ToWatchList.build/Objects-normal/i386/ToWatchList_dependency_info.dat -o /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator/ToWatchList.app/ToWatchList
ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems to have something with the OTHER_LDFLAGS (Other Linker Flags) on my project because if I reorder my pods by going to my application target -> Build Settings -> Other Linker Flags and reorder the items on that list, I can get other pods to generate Linker Errors in the same way (so at least it's not a problem with AFNetworking). Cocoapods and Xcode are not generating any other errors or warnings.
So far I've tried:
Updating to the newest version of Cocoapods with: sudo gem update cocoapods
Commenting out all the pods in my podfile, running pod update to clear them all out and then uncommenting them and run pod update to re-download and install all the dependancies.
Deleting my pod folder and lock file then running pod install to reinstall pods from scratch
Unfortunately none of these steps fixed this error, so I'm guessing there is some Build Setting that I need to tweak in my project but I am unsure what to try next.
Double check that you are opening the .xcworkspace file and not the .xcodeproj file, that's a common mistake that can lead to this kind of problems.
To fix this I had to delete libPods.a under Application Targets -> General -> Linked Frameworks and Libraries. It was highlighted in red (meaning unfound) but I didn't need to replace it; simply clearing it was enough.
For me, the problem was that my project's and Cocoapod's build configurations didn't match, which (I think) meant they were looking in different directories for the compiled libraries.
I had the same issue.
My problem was the the 'Build Active Architectures' on my Target and my Pods target did not match up exactly.
After making them identical the issue was resolved.
Go to "Project Target -> Build Settings -> Preprocessing -> Preprocessor Macros". Set "COCOAPODS=1" in all Debug, Integration, Release under "Preprocessor Macros"
Add the following in "Other Linker Flags" under "Project Target"
$inherited
-ObjC
-lc++
-all_load
Had a same issue after upgrading Deployment target from 7.0 to 8.0 and enabling use_frameworks!

Twilio + Apple o mach error

When I try to run the code I get an Apple O-Mach Linker Error. I'm running up to date XCode 4.6, updated yesterday. I'm running 10.8.2 and here is the error code I get.
A few weeks ago I wasn't getting this issue so I don't know if it's updated SDK from Twilio, the XCode update or what. I've also got one of the library's (libTwilioClient.a) thats red in the frameworks section (This is my first iOS and XCode experience). I've tried linking it and then I get 68 errors about other stuff throughout the program not connecting.
Any help? Oh, BTW, I'm just using the HelloMonkey Example from Twilio's SDK, I haven't changed a single thing except the line pointing to my php server for authentication. Also, I've check for any .m in the headers and there are none. I was hoping that it would be smooth sailing since it's coming from Twilio and it's the "Get Started Quick"... so much for that :/
Ld /Users/Animal/Library/Developer/Xcode/DerivedData/HelloMonkey-
acqupeuamziuogblpxusdjhityyf/Build/Products/Debug-iphonesimulator/HelloMonkey.app
/HelloMonkey normal i386
cd "/Users/Animal/Downloads/TwilioClient-1.1.1-dbefc0b/Quick Start/HelloMonkey
"
setenv IPHONEOS_DEPLOYMENT_TARGET 4.2
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/
iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/
Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.
xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk
-L/Users/Animal/Library/Developer/Xcode/DerivedData/HelloMonkey-acqupeuamziuo
gblpxusdjhityyf/Build/Products/Debug-iphonesimulator "-L/Users/Animal/Downloads/
TwilioClient-1.1.1-dbefc0b/Quick Start/HelloMonkey/../.." -F/Users/Animal/
Library/Developer/Xcode/DerivedData/HelloMonkey-acqupeuamziuogblpxusdjhityyf/
Build/Products/Debug-iphonesimulator -filelist /Users/Animal/Library/Developer/
Xcode/DerivedData/HelloMonkey-acqupeuamziuogblpxusdjhityyf/Build/Intermediates/
HelloMonkey.build/Debug-iphonesimulator/HelloMonkey.build/Objects-normal/i386/
HelloMonkey.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load
-fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.2
-framework AVFoundation -framework Foundation -framework UIKit -framework
CoreGraphics -framework AudioToolbox -framework CFNetwork -framework
SystemConfiguration -lTwilioClient -o /Users/Animal/Library/Developer/Xcode/
DerivedData/HelloMonkey-acqupeuamziuogblpxusdjhityyf/Build/Products/
Debug-iphonesimulator/HelloMonkey.app/HelloMonkey
ld: library not found for -lTwilioClient
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You have to add, other two libraries libcrypto.a and libssl.a along with libTwilioClient.a, then clean and build the project. You are good to go. You can find those libraries in the 'Libraries' folder of the unzipped Twilio bundle. Hope this will help.

Resources