Search code examples
iosxcodearchitecturexcode4compiler-warnings

Xcode Warning: Ignoring file libxml2.2.dylib, built for unsupported file format which is not the architecture being linked


I have been given the task of adding a few features to an iOS app. I checked out the source on SVN to be greeted with over 100 warnings (argh), thankfully I'm down to the last one, which is:

Xcode warning

(The blocked out bits are the client name...).

I believe this warning is saying something along the lines of: 'this XML library is not compatible with the OS architecture that is being linked on the build'.

With the next release, we are supporting only iOS5 and iPhone 4 and above (rather than lower versions of iOS and older iPhones).

So do I change the link architecture? What is the link architecture? How do I change the architecture? Or am I completely on the wrong track?

May be worth mentioning that I am running the latest Xcode, I've added the framework from the Xcode list (link binary with libraries).

EDIT

I only get the message when building from the simulator. It doesn't cause any harm, just winds me up!

Thanks in advance.


Solution

  • Do not link against libxml2.2.dylib, instead link against libxml2.dylib. Linking against that should ensure you are always linked against the correct implementation for your architecture.

    As a general rule, in your applications link to the generic version of a library rather than a specific version. In this case this means libxml2 rather than libxml2.2 .

    You are linking to a (symlink to a) dynamic library which at runtime will automatically point to the correct implementation for the current OS version and architecture. Linking to the specific version of a library does not guarantee this, and you can end up linking to a something that only has a single architecture. Thus, during development if you link to libxml2.2.dylib when targetting the simulator you may be linking against something that is i386, then when you target a device it can't find the correct architecture (because it's trying to use i386 for armvWhatever, which is exactly what you are telling it do).