When you update Xcode and try to build an app that links a third-party static library (.a), the build can fail at the link step with:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /path/to/library.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The project compiled fine before the update, and you have not changed any code. The fix is in your app target’s Build Settings, not in the library itself.
Why this happens
A static library for iOS is often shipped as a universal or “fat” binary. It contains several architecture slices in one file, for example armv7, armv7s, and i386 (for the Simulator), or later arm64 and x86_64. You can inspect the slices with lipo:
lipo -info /path/to/library.a
armv7s was introduced with the iPhone 5 and the A6 chip in Xcode 4.5. Apple added armv7s to the default ARCHS and VALID_ARCHS for new projects. It is a variant of armv7 with a few additional floating-point and NEON instructions. Code built for armv7s can run slightly faster on A6 and later, but armv7 code still runs correctly on those devices.
If your app target now builds for armv7s but the static library you link was built before that Xcode version, the library contains armv7 and i386 but no armv7s slice. The compiler succeeds, but ld fails because it cannot find the required slice for every architecture you asked it to build.
This is not a code error. It is a mismatch between the architectures your project requests and the architectures the prebuilt binary provides. The same pattern repeats with later transitions, such as arm64 or arm64 for the Simulator on Apple Silicon Macs, whenever a vendor has not rebuilt their binary.
How to fix it
You have two temporary workarounds in your own project. Both avoid rebuilding the library. The long-term fix is to get an updated library that includes the missing slice.
1. Remove armv7s from Valid Architectures in your app target
This is the most direct workaround and the one from the accepted solution. You tell Xcode not to build the missing architecture at all.
- In Xcode, select your project in the Project Navigator, then select your app target (not the static library project).
- Go to Build Settings. Make sure All and Levels are shown so you can see resolved values.
- Search for
Valid Architectures(VALID_ARCHS). - Double-click the value and remove
armv7sfrom the list. Leavearmv7and any Simulator architectures. For example, changearmv7 armv7stoarmv7. - Do the same for the project-level Build Settings if it also lists
armv7s, or set the target to not override if you want it to inherit. - Clean and build: Product > Clean Build Folder (Shift+Cmd+K) then build again.
You must change your main app project/target, not the library. You do not have the library source, and changing its settings would not affect the already-built .a file.
Trade-off: your app will run as armv7 on iPhone 5 and later. There is no functional loss, only the small optimization that armv7s would have provided. App Store submission was still accepted with only armv7 at that time, and devices with A6 and later run armv7 code without issues.
If you use CocoaPods or another dependency manager that generates its own targets, check the Pods project as well. Pods may re-add armv7s to VALID_ARCHS on pod install. You can add a post_install hook to strip it, or manually edit the Pods target Build Settings after installing.
2. Set Build Active Architecture Only to Yes for Debug
This is a lighter workaround that many developers prefer during development.
- In your app target’s Build Settings, search for
Build Active Architecture Only(ONLY_ACTIVE_ARCH). - Set Debug to Yes and leave Release as No.
- Build and run on a device.
When ONLY_ACTIVE_ARCH is Yes, Xcode builds only the architecture of the connected device or selected Simulator. If you run on an iPhone 4S (armv7) or a Simulator (i386), it will not try to link armv7s and the error disappears.
Why keep Release as No? With No, a Release or Archive build still tries to build all valid architectures. If you forget to update the library, the Archive will fail and remind you before you submit to the App Store. That is intentional. You do not want to ship a Release build that silently dropped an architecture you intended to support.
This option is ideal if you need to keep armv7s in Valid Architectures for your own code but want to keep moving while waiting for the vendor.
Toggling Build Active Architecture Only to Yes for the target, as many developers reported, is often enough to unblock daily development without editing VALID_ARCHS.
3. Verify slices and get an updated library (proper fix)
The workarounds above are temporary. For a permanent fix:
- Confirm what the library actually contains:
lipo -info /path/to/library.a
# example output: Architectures in the fat file: library.a are: armv7 i386
If armv7s is missing, that confirms the error.
- Contact the library vendor and ask for a build that includes
armv7s. If you have source access, rebuild the library yourself in the newer Xcode with the default architectures. A correctly built universal library should report:
Architectures in the fat file: library.a are: armv7 armv7s i386
- Replace the
.aand headers in your project, clean, and revert your workaround if you wantarmv7ssupport back. SetVALID_ARCHSback to includearmv7sand setONLY_ACTIVE_ARCHfor Debug back to your team’s standard (usuallyYesfor Debug,Nofor Release).
Do not try to fake a slice with lipo -create from an armv7 slice. That produces a binary that claims to be armv7s but is not, and it can cause subtle runtime issues.
How to prevent it
- Keep
Build Active Architecture Onlyset toYesfor Debug andNofor Release. This catches missing slices early in Archive builds but does not block device debugging. - After every Xcode major update, run
lipo -infoon all vendored.afiles and XCFrameworks to see which architectures they actually contain. - Prefer XCFrameworks or Swift Packages over fat
.afiles when available. They handle architecture slicing more explicitly and avoid lipo issues on Apple Silicon Simulators. - Pin third-party binary dependencies to versions that document their supported architectures and Xcode version. Update them as part of your Xcode upgrade checklist.
- If you manage Pods, add a check in CI that builds for both device and Simulator and archives. A CI job that does
xcodebuild archivewithONLY_ACTIVE_ARCH=NOwill surface this linker error before it blocks a release.
FAQ
Can I just add armv7s to the library myself without the vendor?
No, if you only have the .a file. The slice must be compiled from source with the correct compiler flags. You can only change what your app requests. If you have the library source, open its project in the new Xcode and rebuild it with the default Architectures and Valid Architectures so it emits armv7s.
Will removing armv7s affect App Store approval or performance?
At the time armv7s was introduced, Apple accepted apps that only included armv7. Devices that support armv7s run armv7 code correctly. You lose only the minor A6-specific optimization. For later architecture transitions like arm64, removing the required architecture is not an option, so you must get an updated binary.
Why does the error say “file is universal (3 slices)” if armv7s is missing?
Universal means the file contains multiple slices, for example armv7, armv7s, and i386 would be three slices. In the error case, the file is universal but its three slices are armv7, armv7 variant, and i386, or armv7, i386, x86_64, without armv7s. The linker lists how many slices it found, then tells you the one you asked for is not among them.
Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.