create cordova plugin using libxml2

4 posts, 0 answers
  1. Maor
    Maor avatar
    50 posts
    Member since:
    Dec 2012

    Posted 09 Apr 2014 Link to this post

    hi guys.
    i am not sure if this post related to this thread. 
    i am trying to create cordova plugin which use xmpp protocol in ios.
    to android i created one and it works just fine (still need some tuning but at least work).
    in objective-c its a lot of different struggle. i use robbie hanson xmppFramework( https://github.com/robbiehanson/XMPPFramework) and manage to create a static library that i can use from the plugin. the problem start with the dependency in libxml2 and other dynamic libraries. following cordova plugin specs ( http://docs.phonegap.com/en/3.4.0/plugin_ref_spec.md.html#Plugin%20Specification) i managed to create plugin which import the framework i have create and also the dynamic libraries that should be include. but the problem is that libxml2 need a special XCODE config set: seting header search paths to "/usr/include/libxml2".
    as a user of AppBuilder i does not have any access to xcode( i have but i prefer using appbuuilder) to set this header path so basically i am asking if there is option to set headers search paths from plugin.xml file or maybe an compiler flag which can set this option on target?
    thanks for reading and helping.
    best regards .
    maor
  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 11 Apr 2014 Link to this post

    Hi Maor,

    Plugins development is not in the scope of our support service, but if you open a private ticket and send your plugin we could take a look at it.

    Is there an error that requires such header or it is your plugin's requirement?
    Some details would be helpful.
    Thanks.

    Regards,
    Zdravko
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  3. Maor
    Maor avatar
    50 posts
    Member since:
    Dec 2012

    Posted 13 Apr 2014 in reply to Zdravko Link to this post

    hi Zdravko. thanks for your reply.
    xmppFramework for ios depends on the libxml2 which is dynamic lib in ios. also to include it in a project or plugin you need to configure XCODE header search path to look in the "/usr/include/libxml2" and add to other linker flags this flag:"-lxml2". after do so the framework will compile correctly. if i try to compile the plugin in the project without using this requirement it will throw "lexical parse error" on files that try to import headers from "libxml/tree.h".
    hope this info help you to get the big picture. 
    btw, another thing i came accross with is what if i want to include ".xcdatamodeld" file? it throws me 
    "path/where/xcdatamodeld/requiredfile.xcdatamodeld is a directory (not copied)". so is there other way to do so?

    regards maor.
  4. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 16 Apr 2014 Link to this post

    Hello Maor,

    We think that if you add the following line of code to your plugin.xml file in the iOS part should do the trick:
    <source-file src="libxml2.dylib" framework="true" /> so it should look like:

    <!-- ios -->
    <platform name="ios">
    <source-file src="libxml2.dylib" framework="true" />
    .....

    According to this thread this indeed is a directory and I am not sure it is supported. Following this post you can compile it and then try to include it in your plugin.
    Thanks.

    Regards,
    Zdravko
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
Back to Top