Benches iPhone

9

using libxml2 on the iPhone

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I am trying to work with an xml file on the iPhone. It looks like the best way is to use libxml2.

The sample application "SeismicXML" uses libxml2 without problems. however I cannot seem to import libxml2 into my own project.

I am currently including libxml2 by clicking Action->Add->Existing Frameworks and selecting /Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/usr/lib/libxml2 .2.dylib.

When I add an #import <libxml/xmlmemory.h> statement in my header file it gives an error saying there is no such file or directory.

Is there something else I have to do in order to use libxml2.

Thank you in advance for any help I have been struggling with this issue for the past day.

9 replies

Sign in or join Beachball Help to reply.

  1. 0

    William_D

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi,

    You also need to provide XCode with the path to the libxml header files.

    You do this by adding the correct path to "Header Search Paths" in the build settings for your project.

    The path should be:

    /Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/usr/include/libx ml2/

    Hope it works out for you!

  2. 0

    Lazy Eye

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thank you very much William_D.

    My project now compiles perfectly. It is kinda frustrating because I had gone through all the build settings of SeismicXML to get them to match my own and I did not see any differences. Even now when I go back to the SeismicXML project and look at the 'Header Search Paths' option I see it does not have anything.

    Oh well, adding the 'Header Search Path' that you suggested works and now I can continue programming, thanks again and marked as solved.

  3. 0

    parkinglothustler

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I encountered the same issue and was able to fix by adding the header path.

    I also noticed that SeismicXML does not have this setting.

    The only difference I was able to see is that SeismicXML has this for Base SDK:

    /Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk

    and new projects have this set to

    Device - Aspen 1.2

    Couldn't figure out why the difference or how to change it, but adding header path worked.

  4. 0

    Andrew Bray

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The path for the new version is:

    /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/includ e/libxml2

  5. 0

    ScotShinderman

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    the include path does seem to work -- but has anyone come across the following message:

    in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/l ibobjc.A.dylib, file is not of required architecture

    it does not give this error when building for the phone, just the simulator build?

  6. 0

    ScotShinderman

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    of course, realized what was wrong just as i hit send -- the path is platform/target dependent. so there's Developer/Platforms/iPhoneOS.platform and Developer/Platforms/iPhoneSimulator.platform/.../iPhoneSimulator2.0sdk/usr/incl ude/libxml2

    this is much easier to find and fix in a text editor than in the projectSettings dialog box

  7. 0

    sabernar

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    So, what did you do to fix the problem?

  8. 0

    binjaja

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    HELP... I can't get libxml in my iphone project. I read the posts , and followed the instructions but it didn't work. I must be doing something very stupid... This is what I did (in XCODE it says Simulator|Debug in the Overview)

    1. click on Action->Add->Existing Frameworks

    2. I see a lib directory and I then highlight libxml2.2.dylib and click ADD

    3. A window pops up with Reference Type: Default and Text Encoding: Unicode (UTF-8) There are 3 other items that are NOT clicked (copy items into destination,recursively create groups, create folder reference)

    4.I click ADD and the libxml2.2.dylib appears in the Frameworks folder

    5. I click project-> Edit Project Settings

    6. On the Header Search Paths line I click on the empty value and enter

    /usr/include/libxml2/

    7. In one of my files I add

    #include <libxml/xmlreader.h>

    HELP! It doesn't work I keep getting "no such file or directory"

  9. 0

    binjaja

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Scratch that last cry for help.. I figured out I that I was changing the wrong build file. When I selected Project->Edit Project Settings , it brought up Project "MyProjectName" Info file and when I filled in Header Search Paths it did nothing. I reread the post which said to right click on the Target->GetInfo which brings up the Target "MyProjectName" Info file. By changing the Header Search Paths in that file , I got my project to compile. Whats the difference between the two? I figure one is for debug, one for release or something like that. Can anyone point me to documentation explaining what they are for?