I have an xcode code that uses the library libxml2.tbd I needed to make that code a static library (myProjectLib.a) that can be used inside Xamarin.ios following this official guidelines: Binding iOS Library
The problem is that I get alot of errors about undefined symbols while building the xamarin project as if the project can't link libxml2
Error MT5210: Native linking failed, undefined symbol: _xmlTextWriterFlush. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in
I did this binding successfully several times but only without dependency library. but there must be a solution to link it.
things that I already tried :
-adding libxml2.dylib into the xcode library project (same error in xamarin)
-adding (-libxml2,-lxml2) into other linker flags in xcode library project (same error in xamarin)
-adding the libxml2.dylib file into xamarin binding project, xamarin app project resources with always copy options (same error in xamarin)
last tried:
-adding --gcc_flags="-stdlib=libxml2" into (Additional mtouch arguements) in xamarin app project, gave another error that the name is not valid
Error MT5209: Native linking error: clang: error: invalid library name in argument '-stdlib=libxml2'
Add -lxml2
to linker flags in the properties of the native library that is added as a native reference in the iOS binding project. It should look like this.