Thursday, January 06, 2011

libxml2 ios example. libxml2 in xcode

This is a bit of a messy post, but it involves getting apps written using libxml2 to compile in Xcode.

1. Firstly, you'll need the libxml2 framework for Snow Leopard (and annoyingly, gcc to compile it).

You can download the latest libxml2 (get the .tar.gz) from here: ftp://xmlsoft.org/libxml2

Extract the files. Then do a

sudo ./configure
sudo make install

Boom. You're getting there. You can now open your Xcode environment.

2. When you first try to compile, you might get something like "libxml2 _xmlXPathNewContext referenced from" as an error.

This is because the library is not linked in the project yet.

You can link it by right clicking on the "Frameworks" folder, then "Add" -> "Existing Framework"

If libxml2 is installed on your system, you should be able to see it in the drop down box. As in the following screenshot:




3. The other thing that must be done. Is to put the string "/usr/include/libxml2/" in your search paths for your project. This is found by left clicking on your main project. Then clicking the blue 'info' button, followed by the 'build' tab.



I hope this helps someone save hours of frustration and searching like I did.

4 comments:

  1. Anonymous7:35 PM

    Thanks for this! :)

    ReplyDelete
  2. I'm so glad I helped at least someone with this :)

    ReplyDelete
  3. Thanks a lot man. The only problem is the project started giving errors again after installing three20 project. Do you know about any fix after three20 is imported and issues are faced again.

    ReplyDelete
  4. Not too sure about three20 as third party libraries scare me :)

    But apparently if you don't use the TTModule python script to install it but do it manually instead it might work. This link explains how to do it manually:

    http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project

    ReplyDelete