Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa Pods failed to link libraries while running in the debug mode?

I m using pods to link libraries like AfNetworking, facebook etc. and its working great in release mode but I want to check Variables value by debugging but it shows all the variables nil in release mode. I tried to run in debug mode by editing schema but it failed to compile showing various libraries not found error.

Edit I have tried updating the architectures.....but this isn't helping out. Error log in debug mode

ld: warning: directory not found for option '-L/Users/madept/Desktop/personally/Pods/build/Debug-iphoneos'
ld: warning: ignoring file /Users/madept/Desktop/personally/libCloudinary.a, missing required architecture x86_64 in file /Users/madept/Desktop/personally/libCloudinary.a (3 slices)
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AFHTTPRequestOperation", referenced from:
      objc-class-ref in ZRAPIClient.o
  "_OBJC_CLASS_$_AFHTTPRequestSerializer", referenced from:
      objc-class-ref in ZRAPIClient.o
  "_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
      objc-class-ref in ZRAPIClient.o
  "_OBJC_CLASS_$_BITHockeyManager", referenced from:
      objc-class-ref in ZRAppDelegate.o
  "_OBJC_CLASS_$_CLCloudinary", referenced from:
      objc-class-ref in ZRMediaManager.o
  "_OBJC_CLASS_$_CLTransformation", referenced from:
      objc-class-ref in ZRMediaManager.o
  "_OBJC_CLASS_$_DDFileLogger", referenced from:
      objc-class-ref in Zooplr.o
  "_OBJC_CLASS_$_DDLog", referenced from:
      objc-class-ref in Chat.o
      objc-class-ref in ZRManagedObject.o
      objc-class-ref in ZRTelescopingScrollView.o
      objc-class-ref in ZRAddMessageBarController.o
      objc-class-ref in ZRCreateAccountViewController.o
      objc-class-ref in ZRAddressBookHelper.o
      objc-class-ref in Zooplr.o
      ...
  "_OBJC_CLASS_$_DDTTYLogger", referenced from:
      objc-class-ref in Zooplr.o
  "_OBJC_CLASS_$_ELCAlbumPickerController", referenced from:
      objc-class-ref in ZRMediaCaptureController.o
  "_OBJC_CLASS_$_ELCImagePickerController", referenced from:
      objc-class-ref in ZRMediaCaptureController.o
  "_OBJC_CLASS_$_EZAudioPlotGL", referenced from:
      objc-class-ref in ZRMediaCaptureController.o
  "_OBJC_CLASS_$_EZMicrophone", referenced from:
      objc-class-ref in ZRMediaCaptureController.o
  "_OBJC_CLASS_$_EZRecorder", referenced from:
      objc-class-ref in ZRMediaCaptureController.o
  "_OBJC_CLASS_$_FBAppCall", referenced from:
      objc-class-ref in ZRAppDelegate.o
  "_OBJC_CLASS_$_FBErrorUtility", referenced from:
      objc-class-ref in ZRSocialClient.o
  "_OBJC_CLASS_$_FBRequest", referenced from:
      objc-class-ref in ZRSocialClient.o
  "_OBJC_CLASS_$_FBRequestConnection", referenced from:
      objc-class-ref in ZRSocialClient.o
  "_OBJC_CLASS_$_FBSession", referenced from:
      objc-class-ref in ZRAppDelegate.o
      objc-class-ref in ZRSocialClient.o
  "_OBJC_CLASS_$_Mixpanel", referenced from:
      objc-class-ref in ZRAnalyticsTracker.o
      objc-class-ref in Zooplr.o
  "_OBJC_CLASS_$_Reachability", referenced from:
      objc-class-ref in Zooplr.o
  "_OBJC_CLASS_$_SSKeychain", referenced from:
      objc-class-ref in ZRAuthManager.o
  "_OBJC_CLASS_$_SVProgressHUD", referenced from:
      objc-class-ref in ZRAccountEditViewController.o
      objc-class-ref in ZRAppDelegate.o
  "_OBJC_CLASS_$_SocketIO", referenced from:
      objc-class-ref in ZRChatSocketClient.o
  "_OBJC_CLASS_$_TTTAttributedLabel", referenced from:
      objc-class-ref in ZRBubbleViewTextMessage.o
  "_kReachabilityChangedNotification", referenced from:
      -[ZRAppDelegate application:didFinishLaunchingWithOptions:] in ZRAppDelegate.o
      -[ZRChatSocketClient init] in ZRChatSocketClient.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help or suggestion would be appreciated.

like image 354
Narender Tak Avatar asked Nov 28 '14 12:11

Narender Tak


2 Answers

What worked for me is adding $(inherited) to:

  • OTHER_LDFLAGS
  • OTHER_CFLAGS
  • FRAMEWORK_SEARCH_PATHS
  • GCC_PREPROCESSOR_DEFINITIONS

Tip: Inside Build Settings -> (search bar) -> type options above and add $(inherited)

like image 137
Łukasz Szpyrka Avatar answered Oct 28 '22 11:10

Łukasz Szpyrka


if the above answer didn't work for you, maybe the problem comes from when you installed the pods. Check if you had such message when running pod install

The ProjectName [Release] target overrides the OTHER_LDFLAGS build setting defined in `Pods/Target Support Files/ProjectName/Pods-ProjectName.release.xcconfig'. This can lead to problems with the CocoaPods installation

or a similar message but with debug instead of release (or both). If so, delete the pod project in your workspace in Xcode, then follow the answer to this question The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig, I past it here :

This definitely works most of the time:

Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line.

And then run pod install again. It did it for me.

like image 37
Hugues Duvillier Avatar answered Oct 28 '22 12:10

Hugues Duvillier