63

In the new XCode 5.1, arm64 has become among the standard architectures to build for.

However, in current projects of mine I included libraries (Google AdMob for example) that do not yet support this new architecture - these are now causing linker errors:

ld: symbol(s) not found for architecture arm64

Google AdMob 6.8.0 for example is said to be supporting arm64 but I can't really confirm this, unless cputype (16777228) cpusubtype (0) is arm64? (found through the file command-line tool)

libGoogleAdMobAds.a: Mach-O universal binary with 5 architectures
libGoogleAdMobAds.a (for architecture armv7):   current ar archive random library
libGoogleAdMobAds.a (for architecture armv7s):  current ar archive random library
libGoogleAdMobAds.a (for architecture i386):    current ar archive random library
libGoogleAdMobAds.a (for architecture x86_64):  current ar archive random library
libGoogleAdMobAds.a (for architecture cputype (16777228) cpusubtype (0)):   current ar archive random library

Is there a way to go about this?

MrJre
  • 7,082
  • 7
  • 53
  • 66
  • could you show full error logs? – Mani Mar 11 '14 at 10:39
  • Have you checked whether there are updates for the libraries you use. Another option might be to remove the support for arm64 but not sure if Apple will accept you app then. – rckoenes Mar 11 '14 at 10:39
  • Unfortunately you won't be able to use those versions of those libraries until they are updated with compiled support for the arm64 architecture. Try and see if there are any updates to the libraries. – Suhail Patel Mar 11 '14 at 10:40
  • If you have source code of the libraries, rebuild them for arm64. – KudoCC Mar 11 '14 at 10:45
  • 3
    Yes `cputype (16777228) cpusubtype (0)` means arm64, see my [answer here](http://stackoverflow.com/a/22259130/1717391) – Emmanuel Mar 11 '14 at 13:35
  • If you are ok with 32-bit only build, here is an option: http://stackoverflow.com/questions/22341511/how-to-link-with-framework-without-arm64-support-in-xcode-5-1/22341784#22341784 – ohho Mar 12 '14 at 04:05
  • see this answer is worked for me. http://stackoverflow.com/a/22682667/1000906 – Hardik Darji Mar 28 '14 at 09:31

6 Answers6

109

It's not that hard to get rid of arm64 for the time being. all you need to do is to:

  • Edit your target's Build Settings. Change the value for Architectures by opening the drop down, click on Other... and select it, delete the row with value $(ARCHS_STANDARD) and add two rows with values: armv7 and armv7s (or $(ARCHS_STANDARD_32_BIT) as mentioned by @nschum), close the popup.

  • Edit the value Valid Architectures and simply remove the arm64 part of it.

  • Do it for every nested project you might have inside your workspace or project.

Note: This is not a solution, it's just a few steps to mitigate your current problem, please keep following your dependency projects to find out when they come with arm64 compatibility and revert these settings' change ASAP.

starball
  • 20,030
  • 7
  • 43
  • 238
M. Porooshani
  • 1,797
  • 5
  • 34
  • 42
  • This fixed it for me too. I wish Apple was little with kind of stuff. It's maddening when something works yesterday then doesn't. – vboombatz Mar 14 '14 at 20:35
  • I'm a bit confused. My app uses a library that I compiled with armv6, armv7 and armv7s. I have been building it with Xcode5 to run on my arm64 ipad air just fine. But, now that I am on Xcode 5.1, I get the linker errors. So what does this mean? That previously the arm64 ipad air was executing an armv7s executable in backwards compatibility mode? – Steven Lu Mar 16 '14 at 05:55
  • @StevenLu that's right. and you can still do that using the procedure described in the answer. good luck – M. Porooshani Mar 16 '14 at 05:59
  • Please do it also to your librairies included in your project – Medhi Apr 22 '14 at 09:59
  • Let's say I want to support both armv7 and arm64, but drop **armv7s** (to trim a bit the binary size, at the expense of the A6-specific optimizations). Should I use a variant of this approach? – Nicolas Miari Apr 23 '14 at 07:12
  • Of course, the list of architectures your app should include is an array, you can specifically remove or add architectures(comma separated or through pop up array builder). – M. Porooshani Apr 23 '14 at 07:43
  • Hi @nschum, $(ARCHS_STANDARD_32_BIT) works, but I am worried that my app will not run on iPad Air. Can someone assure me it will run? Don't want to wait 2 weeks to find out! – lppier May 27 '14 at 03:10
  • 3
    @lppier, it will work natively on any 64Bit iDevice. you see, almost every 64Bit processor runs 32Bit apps because of backward compatibility, otherwise when the 64 bit devices were introduced, they could have ran none of the apps on the App Store... anyway, you can always make sure by running your app in Simulator for iPad iOS 7 (64bit) – M. Porooshani May 27 '14 at 05:07
19

As of Xcode 5.1 $(ARCHS_STANDARD) now includes arm64 (as well as armv7 and armv7s) whereas with Xcode 5.02, $(ARCHS_STANDARD) only included armv7 and armv7s.

For Xcode 5.1

$(ARCHS_STANDARD) = armv7 armv7s arm64

$(ARCHS_STANDARD_32_BIT) = armv7 armv7s

So if you MUST compile in 64-bit then you need to make sure all included libraries have 64-bit slice. If they do not yet support 64-bit then you will have to compile in 32-bit instead.

But in either case, under your targets build settings you need to make sure that both the Achitectures and the Valid Achitectures are set the same and that they match (see images below). So you can try them both with $(ARCHS_STANDARD) and if it will not compile, then you can try them both with $(ARCHS_STANDARD_32_BIT) which in theory will remove the errors and compile a working project.

-

Like this for 64-bit with arm64 armv7s and armv7:

enter image description here

-

Or like this for 32-bit with armv7s and armv7 only (without arm64):

enter image description here

jsherk
  • 6,128
  • 8
  • 51
  • 83
  • Never touch Valid Architectures. – matt Mar 22 '14 at 17:08
  • @matt - Is there a disadvantage to changing Valid Architectures? I have always set them the same which (for me) has worked fine. – jsherk Mar 22 '14 at 18:56
  • There is just no need. And arm64 _is_ valid. It won't be built if it isn't listed under Architectures so that's all you need to do. – matt Mar 22 '14 at 20:17
  • Hi @matt does removing arm64 from Valid Architectures cause the app to not work on iPad Air? Curious. – lppier May 27 '14 at 03:11
  • The "Valid Architectures" are all the architectures that the compiler can except. The targets "Architectures" build setting is masked with these to determine which architectures are built. There is no reason to modify it. – geowar Aug 06 '14 at 16:52
6

In Build Settings for your target, change the "Valid Architectures" to only those that you support; likely armv7 and armv7s in this case.

If you are using Cocoapods, be sure to change this for all of the targets within the Pods project, and set all of those targets' "Build Active Architecture Only" to "No" for all schemes.

A small change to your podfile to automatically remove the 64-bit build architecture from your cocoapods targets is detailed here: http://cameronspickert.com/2014/01/20/remove-the-arm64-architecture-from-cocoapods-targets

karlbecker_com
  • 969
  • 1
  • 10
  • 16
5

Setting the architecture to $(ARCHS_STANDARD_32_BIT) on XCode 5.1 works. No need to remove arm64 from valid architectures.

The Architecture specifies the actual architectures to build on and would ignore the arm64 entry in the valid architectures(which specifies the superset). Hopefully Apple fixes this soon.

Agnit
  • 141
  • 7
1

I had the same error. Downloading the new version of the Google AdMob SDK 6.8.0 solved the problem. Here is the link: https://developers.google.com/mobile-ads-sdk/download#downloadios

So, disabling the arm64 architecture is not necessary.

RawMean
  • 8,374
  • 6
  • 55
  • 82
  • admob sdk 6.8.0 didn't solve the problem for me. Undefined symbols for architecture x86_64 _AVAudioSessionPortBuiltInSpeaker, _AVAudioSessionPortHeadphones, _OBJC_CLASS_$_AVAudioSession, _OBJC_CLASS_$_CTTelephonyNetworkInfo – Arnold Tang Mar 16 '14 at 14:24
  • @ArnoldTang that seems like you forgot to import some libraries rather than an ARM64 related problem. – MrJre Mar 16 '14 at 17:37
  • MrJre is correct. The symbols that you have listed are unrelated to Google SDK. You need to import the AVFoundation framework. – RawMean Mar 16 '14 at 19:33
  • @RawMean thx for your tips. It is because i'm updating from 6.5.0 to 6.8.0. I just realized that the SDK now requires link to AVFoundation & CoreTelephony after reviewing the release notes. – Arnold Tang Mar 17 '14 at 08:45
1

None of the answers worked for me.
I finally submitted my app installing old Xcode 5.0.2 besides with Xcode 5.1
Used this version of Xcode to archive app without errors.

Download old version of Xcode 5.0.2 here (you must be logged in with your Apple ID):

Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97