Xamarin - can no longer debug on device -error MT5211 - ios

Until the most recent upgrade I could debug on a device. I now get the following errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ZipArchiveDelegate", referenced from:
objc-class-ref in registrar.armv7.o
_OBJC_CLASS_$_MiniZip_ZipArchive_ZipArchive__ZipArchiveDelegate in registrar.armv7.o
"_OBJC_METACLASS_$_ZipArchiveDelegate", referenced from:
_OBJC_METACLASS_$_MiniZip_ZipArchive_ZipArchive__ZipArchiveDelegate in registrar.armv7.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error MT5211: Native linking failed, undefined Objective-C class: _OBJC_CLASS_$_ZipArchiveDelegate. If '_OBJC_CLASS_$_ZipArchiveDelegate' is a protocol from a third-party binding, please check that it has the [Protocol] attribute in its api definition file, otherwise verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _OBJC_METACLASS_$_ZipArchiveDelegate. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5202: Native linking failed. Please review the build log.
I've cleaned, and rebuilt but with no avail. Any ideas?

It turns out this error is caused by the improved strictness of the new default static registrar:
http://docs.xamarin.com/releases/ios/xamarin.ios_7/xamarin.ios_7.2/#1
http://docs.xamarin.com/guides/ios/advanced_topics/registrar/#Protocols_must_have_the_Protocol_attribute
You can work around the problem temporarily by requesting that Xamarin.iOS use the legacy registrar. To do this, add "--registrar:legacy" under "Project Options -> iOS Build -> Additional mtouch arguments".
The components team has also contacted the authors of the ZipArchive component to let them know about the issues with the new registrar, but they have not yet replied. In case the they do not provide an update soon, you can look at transitioning to an open-source binding for the same library written by the Xamarin components team [1]. One caution with this binding is that the method and class names might be different from the ones in the ZipArchive component, and the namespaces are definitely different. So you will need to update the names in your app accordingly.
[1] https://github.com/mono/monotouch-bindings/tree/master/ZipArchive

Having the exact same issue. But both on zipArchive and SDWebImage.
Uninstalled-re-installed xamarin. Did not help.
Created a solution from scratch, added zipArchive and added to the using section.
The project does not build for device. But building for simulator is fine.
Emailed Xamarin support for help.

Related

Symbol(s) not found & Undefined symbols for architecture x86_64: Visitor Framework

Hi i'm trying to integrate BoldChat framework into IOS react native project.
After integrating via following steps
Project target -Build Phases - Link binary with libraries - Plus
button - framework
While trying to build, im getting below error
Undefined symbols for architecture x86_64:
"_utf8_nextCharSafeBody", referenced from:
-[BC_SRWebSocket _innerPumpScanner] in VisitorSDK
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried removing ,re-adding framework , it's not working.
Even tried creating new project and integrating , still error is same.
please let me know how to resolve this. I have even tried similar stack overflow answers, still error exists.
In most cases this points to one or more missing references to frameworks in the section Linked Frameworks And Libraries in the Targets settings of the app in Xcode.
To find out which framework reference should be added:
Right-click on the error in the build time errors
list Choose 'Reveal in Log',
Search in the log for 'Undefined symbols for architecture x86_64'
A list of undefined 'symbols' (mostly class methods and properties)
is displayed
To find out which framework reference should be added, select such
undefined symbol, right-click and choose Search with Google
In most cases you'll end up in the documentation of Apple, which
should give a clue about the related framework
Add the framework in the section Linked Frameworks And Libraries by
clicking on the + button.
Build the app.
If necessary, repeat this procedure for remaining undefined
'symbols'.
In my case libucucore.tbd is missing . Added that and error is gone.

Mach-O Linker error, undefined symbols for architecture after upgrading xcode to 8.0

I have upgraded to XCode 8.0 and it is giving me grief. The first issue was to do with code signing. Which I fixed by selecting a provisioning profile for debug and release from the General project settings. Weird not sure why it couldn't just work as it was compiling perfectly with the previous XCode. Previously XCode would say there is not provisional profile and prompt to fix it and would fix it. Seems a step back here. Anyways, went passed that issue.
The issue I have been facing all day is this error when I compile
Undefined symbols for architecture arm64:
"_write_ret", referenced from:
_dwsl in libtestlib.a(testlib.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I searched for write_ret and it is only a prototype in a header file, this function isn't called anywhere at all!! (Background the static library is part of a bigger project I brought only the files/code I needed to compile the static library for iOS). This was compiling perfectly before for years. I went back to the static libary source code and to humour myself I deleted the write_ret prototype and compiled it and updated the library in the my project and rebuilt. Same error again!. What is going on here?? I confirmed it was definitely using the correct built library.
I then decided I'll just built for armv7 only as this is an enterprise app. I went back to the static library project file and got rid of armv7s and arm64 from "valid architectures". I change "architectures" to armv7. I rebuilt the library and updated the project with the new library.
I also went into the main project and change the valid architectures to build for only armv7.
This time when I built my project I get this error
ld: warning: ignoring file /Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a,
file was built for archive which is not the architecture being linked (armv7):
/Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a
In the terminal I ran lipo libtestlib.a -info I get this:
input file libtestlib.a is not a fat file
Non-fat file: libtestlib.a is architecture: armv7
So it is built for armv7, so what is XCode complaining about really?
I am out of ideas now. Can anyone shed some light here?
I would like to get it to work with all the architectures as it was doing before the XCode upgrade I did on Friday. But worst case atleast compile to work only for armv7. My understanding is that it will still run on anything iPhone 5s and newer anyway.
At first, As you already know, you should support arm64 in order to support 64 bit architecture following Apple's rule.
At second, let's talk about undefined symbol issue, your first question.
I am not sure exactly from your situation description but, one thing to my mind reading the question is that your static library may depend on some dylib(dynamic or shared library) which is deprecated from Xcode 7.The possible scenario is your dylib library was red-marked in the project from Xcode 8 update version because this was replaced with tbd instead of dylib. So, this library is now missing status, and you did remove it in the library list and you forgot it. That's why your _write_ret symbol in libtestlib.a cannot be linked for architecture arm64 anymore.(dylib is missing status.)
if this scenario is true, import tbd instead of dylib.(text-based stub libraries).
let's talk about your second question related to error log.
ld: warning: ignoring file /Users/rrr/Library/Developer/Xcode/DerivedData/P- eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a,
file was built for archive which is not the architecture being linked (armv7):
/Users/rrr/Library/Developer/Xcode/DerivedData/P- eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a
This log can be about Build Active Architecture Only in Xcode build setting.
check 'Build Active Architecture Only' from Yes to No.
It error log could be generated when Build Active Architecture Only is set to YES in your build setting situation.
and, if it does not work, Have you ever clean your DerivedData directory and project?
If you already tried, it could be possible that your static library is actually not in the /Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a.
so, you can move your static library output into this project and try it again.
These are just scenario for your situation as I got your question.
I wish it became a little help.
Thanks.

Trouble adding -ObjC flag to iOS project

I have an iOS project which includes the Parse library. It has been working fine.
Today, I needed to add the Google Conversion Tracking SDK to my project. The instructions for adding this SDK require that I change my project settings to include the -ObjC linker flag.
When I did this, I could no longer compile my project. The errors I receive are of the form "Undefined symbols for architecture x86_64", and in every case the source of the error is something in the Parse SDK. Here is one example of the 6 errors I'm getting:
Undefined symbols for architecture x86_64:
"_ACAccountTypeIdentifierTwitter", referenced from:
-[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
I've never had to use the -ObjC flag explicitly before. My understanding is that this flag tells the compiler to link every class that was compiled even if it isn't explicitly referenced in the source code. Other than producing a larger executable, I can't see how this would cause a problem.
Appreciate any solutions or ideas.
Thanks.
I recently had a similar issue (not with parse though).
Open PF_Twitter and see what frameworks are included in it's header and implementation files. Then go to your target's Build Phases and add those frameworks in "Link Binary With Libraries".
If this doesn't help, other alternatives are discussed under this stack overflow question--
Undefined symbols for architecture arm64 Parse
Thanks. Adding the Social framework fixed the problem for me.

Binding iOS Static Library to Xamarin.iOS and using the dll

I am able to successfully create dll file for my Objective-C static library. But when I am try to reference that dll from Xamarin.iOS application and compiling, it is giving me lot of error like...
Error MT5210: Native linking failed, undefined symbol: _AudioFileClose. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210)
Error MT5210: Native linking failed, undefined symbol: std::ios_base::Init::Init(). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210)
Error MT5202: Native linking failed. Please review the build log. (MT5202)
After this, I tried to link my .a library using Addtional mtouch Arguments. After adding those arguments, I am getting the new error.
Could not parse the command line arguments: Cannot bundle unregistered option '-o'.
Could someone please help me in resolving this issues.
As Stephane mentioned, there's a IsCxx property on the LinkWithAttribute that you can set to specify that the .a library is a c++ library. That'll solve the std::ios_base::Init::Init() error.
To solve the undefined symbol: _AudioFileClose error, you might try adding the CoreAudio or perhaps AudioToolbox framework to the list of frameworks to link against:
[assembly: LinkWith (..., IsCxx = true, Frameworks = "CoreAudio AudioToolbox")]
Hopefully even if that doesn't quite work, it'll get you headed in the right direction.
Finally figured out the error!!
[assembly: LinkWith (..., IsCxx = true, Frameworks = "CoreAudio AudioToolbox", LinkerFlags = "-lstdc++ -lz" )]
In iOS Binding Projet
Options > Build > Compiler > Addition Arguments
-cxx -gcc_flags "-stdlib=libstdc++ -L${ProjectDir} -lMylibrary -force_load ${ProjectDir}/libMylibrary.a”
In my demo application
Options > iOS Buidl > Addtional mtouch Arguments
--gcc_flags="-stdlib=libstdc++"
By giving the proper flags in all the places it resolved my issue.
I resolved this problem installing the new version of Xcode. (now 7.1)
The error is misleading but now it works!

Cocoa Static Library with ZXing error

My project uses some Cocoa static libraries, one of which is a Zxing Project. I am getting a lot of errors while trying to incorporate this project. Weirdly enough, I was able to create a demo with Zxing in a separate project, without any errors. My main project builds and runs ok, as long as I do not include the Cocoa static library for Zxing.
So the question is, how do I include the ZXing static library to my Cocoa project? How do I configure library (e.g. how do I set the Header Search Paths~~).
Thanks.
Some detail about my project
The Structure
EnjoyMobile
-CustomStaticLibrary.xcodeproj
-ZXingWidegt.xcodeproj
Header search Paths in my -CustomStaticLibrary Target
./zxing/iphone/ZXingWidget/Classes
./zxing/cpp/core/src
The error
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_QRCodeReader", referenced from:
objc-class-ref in libCustomerLibrary.a(CustomerViewController.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Zxing is kind of a painfull integration, also in the newer versions of Xcode Apple added more error checks. I would suggest you to use cococapods for a better integration or this ObjectiveC wrapper here
It's not seeing some of the lib classes. Double check the steps in the README, particularly step 2. If it still fails, post the link command that fails.

Resources