Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 5.1 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

After updating to Xcode 5.1, I can no longer build my project for the 64-bit simulator, receiving this error:

 No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386). 

These are my target build settings:

Xcode target build settings

I tried changing "Build Active Architecture" to No, as well as adding "i386" to the "Valid Architectures", unfortunately neither worked. Thanks for any suggestions!

like image 721
ebi Avatar asked Mar 11 '14 14:03

ebi


1 Answers

What you need to do is just set the ONLY_ACTIVE_ARCH to NO (at least works for me). Below is a screenshot for it:


EDIT:

As far as I know (please point it out if there's something wrong, thanks), if you set ONLY_ACTIVE_ARCH to YES, it means the Xcode will only build for the active architecture (which refers to the device that's active in Xcode currently). Seems Xcode's default setting is set Debug to YES, so it won't build binaries for other architectures when you only want to build for a special device that connected to your Mac.

The reason failed to build might be that, the project does not support the architecture of the device you connected. So the best solution is to add the right architecture for your device. Below is a list for architectures & the devices that support:

  • ARMv8/ARM64: iPhone 6, iPhone 5s, iPad Air, Retina iPad Mini
  • ARMv7s: iPhone 5, iPhone 5c, iPad 4
  • ARMv7: iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini
  • ARMv6: iPhone, iPhone 3G, iPod 1G/2G

So why "set the ONLY_ACTIVE_ARCH to NO" works? Because the device can still run the binary that built for all architectures you added (pass the build), but will lose some performance. This's just a quick solution, but not best.


Note: The more architectures you added, the bigger the binary will be generated. So it's good to choose right architectures for your project. ;)

like image 148
Kjuly Avatar answered Oct 21 '22 02:10

Kjuly