Xcode 4.5 and ‘file is universal (2 slices) but does not contain a(n) armv7s slice’

After firing up Xcode 4.5 for the first time, adding 4″ iPhone support to 20 Rep Squats, and attempting to run it on my device, Xcode gave me a bizzare error:

file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/Marty/Desktop/Projects/20 Rep Squats/libCorePlot-CocoaTouch.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

So, what gives?

It turns out that Xcode 4.5 adds support for the armv7s architecture, as opposed to the standard armv7 architecture. If you are using a library that has not been compiled for armv7s, and your project is set to armv7s, you will get the above error. In my case, it’s the Core Plot library that is throwing the error.

Fixing the problem is simple. You just need to remove armv7s from the list of valid architectures.

-Select your project from the Project Navigator

-Select your target from the list of targets

-Select the build settings tab

-Find the ‘Valid Architectures’ setting. It should say armv7 armv7s.

-Double-click on it to edit it, select armv7s, and press the button.

The Valid Architectures setting should now look like this:

And that’s it! Your code will now compile correctly.

7 Comments

  1. Now I get this:
    No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7s, VALID_ARCHS=armv7).

    Reply

Leave a Reply to Jittender Thakur Cancel reply

Your email address will not be published. Required fields are marked *