iOS framework file was built for x86_64 which is not the architecture being linked (arm64), linker command failed with exit code 1

Edison Lo
Edison Lo
Mar 7, 2018 · 3 min read

This is a common error when you deal with frameworks. Most people just follow the solutions on stackoverflow(Set Build Active Architecture Only to NO, and add i386, x86_64 to the valid architecture), but indeed it does not take much time to understand the rationale in behind.

1. Architecture in iOS

armv64: iPhoneX, iPhone 5s-8, iPad Air — iPad Pro

armv7 : iPhone3Gs-5c, iPad WIFI(4th gen)

armv6 : iPhone — iPhone3G

the above if for real devices

i386 : 32-bit simulator

x86_64 : 64-bit simulator

the above list is downward compatible, which means iPhoneX can runs with armv6 as well, and just can not fully utilize the functions of armv64

more info about iOS architectures can be found here:


2. What is Build Active Architecture Only?

If selected “Yes”, it will only build your framework to the “selected device”, either real devices(armv) or simulator(x86_64 or i386). For “No”, it will build your framework to your list of “Valid Architectures”

By default, in debug mode, it is “Yes”; and in release more, it is “No”, which can save compiling time in debug mode and ensure your release project framework runs on all architectures that you specified.

Thats why the accepted answer worked by forcing the framework to build for all architectures, however by reading more you will know what is behind and can definitely save time in compiling your framework. Of course, more control in yourself as well.

So, if you are working on a framework, and want to import to another project, if you compile the framework with Build Active Architecture Only “Yes” with simulator(i386 or x86_64), and then import to your project with Build Active Architecture Only “Yes” with a real device(armv), you will encountered this error.

Looking to the error description:

file was built for x86_64 which is not the architecture being linked (i386) will imply you build your framework in 64-bit simulator and your merged project build with 32-bit simulator.

while a more common would be:

framework file was built for x86_64 which is not the architecture being linked (arm64): which implies your framework is built in simulator while your merged project is build with real device.


3. Extracting the framework

A common practice would be right click the framework and select Show In Finder, while most developers keep the Finder open, and the newly compiled framework will replace the old one, without closing Finder and reopen again. Yes it is right, but if you switched the build target device in between, the frameworks will result in different folders. Sometimes you think you have compiled your framework but indeed it is in another folder. My suggestions would be always select Show in Finder to prevent the framework you import is not the latest one.

The two different folders: Debug-iphoneos and Debug-iphonesimulator

From now on, you should be confident when encountering the framework link error issues, cheers mate.