Archived Forum Post

Index of archived forum posts

Question:

iOS Linker Error: file was built for archive which is not the architecture being linked

Dec 04 '15 at 09:31

I get this error when trying to link may app on iOS:

ld: warning: ignoring file /myProjects/xyz/libchilkatIos.a, file was built for archive which is not the architecture being linked (armv7): libchilkatIos.a

Answer

The problem is exactly as stated: You have somehow specified in your XCode project settings to link with a libchilkatIos.a that is for the wrong architecture. For example, perhaps you are building for armv7, but you are trying to link against the libchilkatIos.a for arm64.

(See http://www.chilkatsoft.com/downloads_ios.asp)

Also see: http://www.chilkatsoft.com/xcode-link-static-lib.asp

The solution is to link against the correct .a that matches your architecture, or to build a universal .a (as shown at http://www.chilkatsoft.com/downloads_ios.asp) and then link with the universal .a

To see the actual architecture of a particular .a static library, you can do this:

  1. Copy the libchilkatIos.a to some temporary/empty directory.
  2. Extract the objects from the .a with this shell command: ar -x libchilkatIos.a
  3. Examine any .o using the "file" command: file CkCert.o