1

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'

1 Answer 1

4

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.

2
  • yep worked like a charm! your photo showed me my mistake also , I was adding the native library as "Add a file" which I realized its deprecated, the right way which will result your the properties of your photo is adding the library inside (Native References) folder.. Had to explain for future fellas :) Thank you @voytasify
    – Aproram
    Jun 11, 2017 at 0:49
  • Thank you! This response was everything I hoped for: simple, concise, to the point and illustrated! Dec 20, 2018 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.