Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libxml/tree.h no such file or directory

I am getting following errors.

libxml/tree.h no such file or directory

I have already added libxml2.dylib to my project, however I am getting this type of trouble. Please help me.

like image 418
Sagar Kothari Avatar asked Sep 15 '09 18:09

Sagar Kothari


2 Answers

Follow the directions here, under "Setting up your project file."

Setting up your project file

You need to add libxml2.dylib to your project (don't put it in the Frameworks section). On the Mac, you'll find it at /usr/lib/libxml2.dylib and for the iPhone, you'll want the /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/usr/lib/libxml2.dylib version.

Since libxml2 is a .dylib (not a nice friendly .framework) we still have one more thing to do. Go to the Project build settings (Project->Edit Project Settings->Build) and find the "Search Paths". In "Header Search Paths" add the following path:

$(SDKROOT)/usr/include/libxml2 

Also see the OP's answer.

like image 67
Matt Ball Avatar answered Sep 26 '22 05:09

Matt Ball


Adding libxml2 in Xcode 4.3 / 5 / 6

Adding libxml2 is a big, fat, finicky pain in the ass. If you're going to do it, do it before you get too far in building your project.


You need to add it in two ways:

1. Target settings

Click on your target (not your project) and select Build Phases.

Click on the reveal triangle titled Link Binary With Libraries. Click on the + to add a library.

Scroll to the bottom of the list and select libxml2.dylib. That adds the libxml2 library to your project.

2. Project settings

Now you have to tell your project where to look for it three more times.

Select the Build Settings tab.

Scroll down to the Linking section. Under your projects columns double click on the Other Linker Flags row. Click the + and add -lxml2 to the list.

Still more.

In the same tab, scroll down to the Search Paths section.

Under your projects column in the Framework Search Paths row add /usr/lib/libxml2.dylib.

In the Header Search Paths and the User Header Search Paths row add $(SDKROOT)/usr/include/libxml2.

In those last two cases make sure that path is entered in Debug and Release.

3. Clean

Under the Product Menu select Clean.

Then, if I were you (and lets face it, I probably am) I'd quit Xcode and walk away. When you come back and launch you should be good to go.

like image 22
e.w. parris Avatar answered Sep 24 '22 05:09

e.w. parris