Symbol(s) not found for arm64

My app builds and runs fine on the Sim and on the phone/Watch, but fails with "Symbol(s) not found for arm64"

when building an archive for Generic iOS Device + watchOS Device or my Phone/watch ( iPhone 6/ Watch 2)

I have an earlier version of my project that Archives fine, and I can't detect any changes that may have triggered this condition.

There are lots of different suggestions on Stackoverflow, but none of them show any real understanding of the issue.

Whilst I'm desperate for a solution, I am really looking for a root cause of the issue.


Xcode 9.2 mixed Obj-C and Swift app (ios is in Obj-C, watch is Swift) on iMac 27"

I have tried:

  • pod deintegrate, install and update
  • clearing DerivedData
  • restarting the iMac
  • checking the build settings:
    • Other Linker Flags : $(inherited) -ObjC -l"c++" -l"iconv" -l"xml2" -l"z" -lsqlite3.0 -lresolv
    • Build Active Architectures Only : No

Solved Answer

>> The references to duplicate symbols make no sense at all!


It's kinda the same problem, just the other way round (too many search paths, something like that).


>> So, once again, I am out in the snow with nowhere to go!


Here's what I suggest. Mentally at least, take the project apart, separate what is compiled directly into your main target, what is brought in via pods, what is brought in as other 3rd party libraries. This gives you a kind of "bill of materials".


Then start an entirely new Xcode project. Add the targets you need. Add the source that should be in the project as source. Get new, fresh copies of the 3rd party pods and libraries you need. Then just grind away, building up the project from scratch. Commit changes to your git repository at every step, so that if you go wrong you can put things back.


This is not a trivial task, but it's probably not as daunting as it might seem.

18 Replies

It might help to post the build transcript that shows the tool invocation line(s) and any other logged errors or messages. (You can edit out any sensitive path components before posting, if necessary.)


>> I can't detect any changes that may have triggered this condition


Newer versions of Xcode change the set of hardware architectures that are supported, so existing projects can fail, sometimes just because you used to be building for an architecture that you never used.

"..post the build transcript.." Do you mean this:


Ld /Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/IntermediateBuildFilesPath/RaceQs.build/Release-iphoneos/raceQs.build/Objects-normal/arm64/raceQs normal arm64

cd /Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod

export IPHONEOS_DEPLOYMENT_TARGET=9.0

export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -L/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos -L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/GoogleAnalytics-iOS-SDK -L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/mailcore2-ios/lib -L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Library -L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Release-iphoneos -L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Debug-iphoneos -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/Bolts -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/CocoaAsyncSocket -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/DLAlertView -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/FBSDKCoreKit -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/FBSDKLoginKit -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/FacebookCore -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/FacebookLogin -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/SSKeychain -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/SSZipArchive -F/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/SWRevealViewController -F/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/Fabric/iOS -F/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod -filelist /Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/IntermediateBuildFilesPath/RaceQs.build/Release-iphoneos/raceQs.build/Objects-normal/arm64/raceQs.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/IntermediateBuildFilesPath/RaceQs.build/Release-iphoneos/raceQs.build/Objects-normal/arm64/raceQs_lto.o -Xlinker -final_output -Xlinker /Applications/raceQs.app/raceQs -fobjc-arc -fobjc-link-runtime -ObjC -lc++ -liconv -lxml2 -lz -lsqlite3.0 -lresolv -framework WatchConnectivity -framework Security -lz -framework CFNetwork -framework MessageUI -framework Accelerate -weak_framework AdSupport -framework CoreData -framework CoreText -framework SystemConfiguration -framework QuartzCore -framework CoreImage -framework MapKit /Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/BuildProductsPath/Release-iphoneos/Alamofire.framework/Alamofire -weak_framework Social -framework CoreLocation -framework CoreMotion -framework AVFoundation -framework AudioToolbox -weak_framework Accounts -framework UIKit -framework Foundation -lGoogleAnalyticsServices -framework CoreGraphics -framework Pods_raceQs -Xlinker -dependency_info -Xlinker /Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/IntermediateBuildFilesPath/RaceQs.build/Release-iphoneos/raceQs.build/Objects-normal/arm64/raceQs_dependency_info.dat -o /Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/ArchiveIntermediates/raceqs\ watch\ app/IntermediateBuildFilesPath/RaceQs.build/Release-iphoneos/raceQs.build/Objects-normal/arm64/raceQs

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Library'

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Release-iphoneos'

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Debug-iphoneos'

Undefined symbols for architecture arm64:

"_OBJC_CLASS_$_SWRevealViewControllerSegueSetController", referenced from:

objc-class-ref in MenuTableViewController.o

"_OBJC_CLASS_$_MCOAddress", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_MCOMessageBuilder", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_GCDAsyncSocket", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_DLAVAlertViewTheme", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_MCOSMTPSession", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_MCOAttachment", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_SSZipArchive", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_GCDAsyncUdpSocket", referenced from:

objc-class-ref in MainClass.o

"_OBJC_CLASS_$_DLAVAlertViewButtonTheme", referenced from:

objc-class-ref in MarkDetailsViewController.o

objc-class-ref in TrackUploadViewController.o

objc-class-ref in TrackDetailsViewController.o

objc-class-ref in BoatDetailsViewController.o

objc-class-ref in SettingsCalibrateViewController.o

"_OBJC_CLASS_$_DLAVAlertView", referenced from:

objc-class-ref in MarkDetailsViewController.o

objc-class-ref in TrackUploadViewController.o

objc-class-ref in TrackDetailsViewController.o

objc-class-ref in MainClass.o

objc-class-ref in SignupViewController.o

objc-class-ref in BoatDetailsViewController.o

objc-class-ref in SettingsMotionViewController.o

...

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Yep, that was what I meant. 🙂


So, the problem is nothing to do with architectures (I think), but rather than not everything is being linked because of these search path errors:


ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Library'

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Release-iphoneos'

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Debug-iphoneos'


While it's possible that your project contains search paths that aren't actually used, it looks like this build depends on the product of another build target in the same project (.../build/Release-iphoneos and .../build/Debug-iphoneos). It's also odd that both the debug and release products are linked against.


So, my guess is that your projects search path settings are messed up, possibly in multiple ways. One thing to keep in mind is that when you tell xcode to link (say) an app against libraries or frameworks built in the same project, you typically want the library be reference to be in the "relative to build products" form. (You can adjust the referencing form via the File attributes inspector.) It looks like you might have (inadvertently or intentionally) added both debug and release paths explicitly to get around the issues that the wrong file referencing form would give you.


Sorry, it's hard to be specific, because it's hard to describe a project structure in any detail, in a forum post like this.

How annoying that the reported error related to architectures, but may be a complete red herring!


As you may have guessed, this is a project that I have inherited (from a departed predecessor) so I haven't been in on the earlier development.

I have not made any changes to the build settings since the earlier working version, so the ref's to missing items:

"ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Library'

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Release-iphoneos'

ld: warning: directory not found for option '-L/Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Debug-iphoneos' "

Is very odd.

And they were "only" warnings, so do you really think that's the problem, or something more obscure???

>> do you really think that's the problem

It certainly very, very suspicious. The link fails because the linker doesn't find all the object files, and paths that are supposed to be searched for object files don't exist. It's almost a chain of evidence, but not quite.

Whether or not that's the problem, I think your first duty is to eliminate the condition that leads to these messages.

I agree, but sadly don't have the experience to do it. 😟

There certainly isn't a directory "Users/alansmith/Documents/raceQs-iOS/ios/raceqs_pod/Library" (and I don't hink ever has been).

Nor do I know where the reference to that directory might be found in my Xcode project.

The reference to "Library" in the missing missing directory path is odd as I don't think there are any files in the app other than the application code ( Obj-C and Swift) and the Pods.


Any assistance would be greatly appreciated to squish this.

The place to start is your list of undefined symbols. Pick one, say the class "DLAVAlertView". What target/module/file/library/framework is the defined in? How does the project look like it intended to include this in the link? (For example, is it in the list of libraries and frameworks to link against, in the Info tab of the project editor for the target being built?) Or is it in a Build Phase that looks manually created? Is there a project item for it, and what does the Files inspector say about its path and/or referencing style?


Once you've solved one, you'll presumably know what to fix for the others.

I really appreciate your perserverence.

In the case in point, DLAlertView (as are all the objects reported as missing in the error report) is an external library (in my Podfile) referenced in a few of the (legacy) Obj-C files.

It is imported as

#import "DLAVAlertView.h"

and referenced in the application code like, for example:

'DLAVAlertView *alertView = [[DLAVAlertView alloc] initWithTitle:@"Please specify mark name" message:nil delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];

The code compiles and runs on theSIM and a real device, so the library must be correctly referenced.

As I said, it only gets reported as an error when I go to build an Archive.

You're on your own with podfiles. 🙂


The problem (from the point of view of these forums) is CocoPods is its own ecosystem, and how it integrates into Xcode is its problem, not Xcode's.


I wish I had better news for you.

Just one more shot before you throw me to the wolves!

As a newbie, I can't understand how a successful build for the Sim or a device can fail in a build for an Archive.... How are they different????

> How are they different????


Along with alternate signing/profiles, archiving adds a layer of (pre) store checks that aren't included with debug/dev (vs. dist) builds.


All in all, it is a non-trivial process that requires patience and sticktoittiveness by the bushel 🙂


Good luck.

So, once again, I am out in the snow with nowhere to go!

And now, with no changes to the project, the build is failing in a debug/dev build

Here's the tail of the latest build log:

" ....

/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/RaceQs.build/Debug-iphonesimulator/raceQs.build/Objects-normal/x86_64/SettingsCalibrateViewController.o

duplicate symbol _distToStart60 in:

/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/RaceQs.build/Debug-iphonesimulator/raceQs.build/Objects-normal/x86_64/main.o

/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/RaceQs.build/Debug-iphonesimulator/raceQs.build/Objects-normal/x86_64/SettingsCalibrateViewController.o

duplicate symbol _box30 in:

/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/RaceQs.build/Debug-iphonesimulator/raceQs.build/Objects-normal/x86_64/main.o

/Users/alansmith/Library/Developer/Xcode/DerivedData/RaceQs-bbhgybwntkuurvdrohgpfkgubine/Build/Intermediates.noindex/RaceQs.build/Debug-iphonesimulator/raceQs.build/Objects-normal/x86_64/SettingsCalibrateViewController.o

ld: 5563 duplicate symbols for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

"

The references to duplicate symbols make no sense at all!

Xcode is messing with me!

Sorry, I forgot to add the standard disclaimer to my comment.


"This is not an offer to troubleshoot 3rd party tools, libs etc."

>> The references to duplicate symbols make no sense at all!


It's kinda the same problem, just the other way round (too many search paths, something like that).


>> So, once again, I am out in the snow with nowhere to go!


Here's what I suggest. Mentally at least, take the project apart, separate what is compiled directly into your main target, what is brought in via pods, what is brought in as other 3rd party libraries. This gives you a kind of "bill of materials".


Then start an entirely new Xcode project. Add the targets you need. Add the source that should be in the project as source. Get new, fresh copies of the 3rd party pods and libraries you need. Then just grind away, building up the project from scratch. Commit changes to your git repository at every step, so that if you go wrong you can put things back.


This is not a trivial task, but it's probably not as daunting as it might seem.

Yes, that's what I thought.


I am attempting to port my watch app which was originally written for Pebble in Javascript and C, and then, on their demise, ported to Garmin in Monkey C, and now, on hitting unsurmountable issues with Garmin, porting to Apple Watch.

At the same time, I am integrating the watch app with a "legacy" iOS app which is very mature, complex and Obj-C, so I don't really have the background to grind away and rebuild the project!

So after sleeping on it, my plan is the revert to a working commit and manually re-apply the changes.


My conclusion is that there is something very flaky in Xcode's build process which is manifesting itself in these entirely spurious build errors.

IMHO, Apple has done a brilliant job in keeping a single development environment across the entire platform range, but that has come at the cost of simplicity.


For an experienced developer coming to Apple for the first time (yes, there are many parallel universes which entirely exclude Apple!) trying use Xcode to attach a watch app to an iOS app, the build mechanism is a nightmare.


Thank God for the git integration with Xcode, it should save a poor sinner like me.


So, thanks for your assistance, andI will grind away to rebuild from a working set.