IPhone library: file does not have required architecture

I've searched for hours but still don't understand what is wrong with my configuration. My project uses self-written libray (myLib). This library is compiled to work just for the simulator and it works great there.

What needs to be changed so that it also compiles for my iPhone ?

This is my current warning:

ld: warning: in /.../myLib.a, file is not of required architecture

      

This is my config (from myLib.a)

alt text

I found many articles explaining the cause of this error, but I could not find a solution:

The simulator runs on x86 architecture and the device uses ARM architecture.


What do I need to change in order for my library to work on my iPhone?

thank


Edit:

What I have done so far:

  1. Removed both projects
  2. Install library to "Device" (3.1)
  3. Built the library
  4. Drag and drop my library .a file into my application

Result:

This works in the simulator, but installing the active SDK on the device still throws file is not of required architecture

errors file is not of required architecture

.

I also tried mahboudz (thanks for the support) link . He explains how to build a project using a shell script. However, Xcode continues to complain that the library file has the wrong architecture and the build fails.

This must be a really stupid newbie mistake.

+2


source to share


3 answers


You need to add both .a files, one created for the device (build / $ config-iphoneos) and the one created for sim (build / $ config-iphonesimulator) for the new project. Make sure to name them differently before discarding them. This is how admob and similar offerings ship their static libraries.



+3


source


You need to compile your library for Intel so the Simulator can use it (as I already made sure you already did) and then compile it for ARM so it can work on the iPhone. Then you need to combine the two libraries. There are various ways to achieve this, or to make it more automatic.

Here are some links to help you:



http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html http://www.clintharris.net/2009/iphone-app-shared-libraries/

+1


source


I met the same problem too. But it looks like you don't have to drag and drop two files .a

into your app project to fix this issue. This is what I did:

  • Drag the static library project to the framework group of the project project
  • "Get info" for a target in an app project
  • Install direct dependency of static library
  • Clean up all unnecessary assemblies (like a simulator assembly) in a static library project
  • Creating an application project
0


source







All Articles