Cocoapods: Linker error in 0.25.0

Created on 22 Sep 2013  路  17Comments  路  Source: CocoaPods/CocoaPods

I have used this Podfile

platform :ios, '6.0'
xcodeproj 'Crazy Valet'

pod 'AdMob'
pod 'Appirater'
pod 'PSAlertView'
pod 'ChartboostSDK'
pod 'GoogleAnalytics-iOS-SDK'
pod 'TestFlightSDK'
pod 'UIAlertView-Blocks'
pod 'ZUUIRevealController'

And got this linker errors:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_Chartboost", referenced from:
      objc-class-ref in AppDelegate.o
      objc-class-ref in MainViewController.o
  "_OBJC_CLASS_$_GADBannerView", referenced from:
      objc-class-ref in MainViewController.o
  "_OBJC_CLASS_$_GADRequest", referenced from:
      objc-class-ref in MainViewController.o
  "_OBJC_CLASS_$_GAI", referenced from:
      objc-class-ref in AppDelegate.o
      objc-class-ref in MainViewController.o
      objc-class-ref in PurchaseViewController.o
      objc-class-ref in LevelSelectionViewController.o
  "_OBJC_CLASS_$_GAIDictionaryBuilder", referenced from:
      objc-class-ref in AppDelegate.o
      objc-class-ref in MainViewController.o
      objc-class-ref in PurchaseViewController.o
      objc-class-ref in LevelSelectionViewController.o
  "_OBJC_CLASS_$_GAITrackedViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
      _OBJC_CLASS_$_PurchaseViewController in PurchaseViewController.o
      _OBJC_CLASS_$_LevelSelectionViewController in LevelSelectionViewController.o
  "_OBJC_CLASS_$_TestFlight", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_METACLASS_$_GAITrackedViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
      _OBJC_METACLASS_$_PurchaseViewController in PurchaseViewController.o
      _OBJC_METACLASS_$_LevelSelectionViewController in LevelSelectionViewController.o
  "_kGADAdSizeBanner", referenced from:
      -[MainViewController viewDidLoad] in MainViewController.o
  "_kGADAdSizeLeaderboard", referenced from:
      -[MainViewController viewDidLoad] in MainViewController.o
  "_kGAISessionControl", referenced from:
      -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Only AdMob, Chartboost and GAI produce linker errors.

discussion

Most helpful comment

@ppaulojr

As @irrationalfab mentioned, it's possible that there are some default CocoaPods settings that you may have overridden. If you go to "Other Linker Flags" under "Build Settings" and hit the backspace key, this will reset your linker flag settings to the default pod settings.

I'd recommend saving your current settings before doing this and adding your settings back in one at a time to see which one is at fault.

All 17 comments

I assume those are all prebuilt binaries? Which Xcode are you using? Are you targeting iOS 6 only?

I'm targeting iOS7 and 6, and no, those are the pod distribution of those libraries.

I'm using Xcode 5.

The full link command generated by CocoaPods is:

Ld /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphonesimulator/Crazy\ Valet.app/Crazy\ Valet normal i386
    cd /Users/pedropaulo/git/iphone/valet
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphonesimulator -L/Users/pedropaulo/git/iphone/valet/Pods/AdMob -L/Users/pedropaulo/git/iphone/valet/Pods/ChartboostSDK/Chartboost -L/Users/pedropaulo/git/iphone/valet/Pods/GoogleAnalytics-iOS-SDK -L/Users/pedropaulo/git/iphone/valet/Pods/TestFlightSDK -F/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphonesimulator -filelist /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphonesimulator/Crazy\ Valet.build/Objects-normal/i386/Crazy\ Valet.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphonesimulator/libPods.a -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -lz -framework CoreData -weak_framework Twitter -weak_framework AdSupport -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework StoreKit -framework AudioToolbox -framework MessageUI -framework QuartzCore -framework SystemConfiguration -weak_framework GameKit -lPods -Xlinker -dependency_info -Xlinker /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphonesimulator/Crazy\ Valet.build/Objects-normal/i386/Crazy\ Valet_dependency_info.dat -o /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphonesimulator/Crazy\ Valet.app/Crazy\ Valet

encountered the same issue.

@ppaulojr did you find any workaround?

Found workaround: switch to NO for Build for Active Architecture in build settings

I assume those are all prebuilt binaries?

I'm targeting iOS7 and 6, and no, those are the pod distribution of those libraries.

Pod distributions might include pre-built binaries, which appear to be the cause of this issue.

@shsteven Did you set this on your project鈥檚 target(s), or in the Pods Xcode project?

@alloy So the problem is the Pod distributions of the libraries? Do you know how to fix it?

@ppaulojr I鈥檓 waiting for @shsteven to answer, but in the meantime you could try fiddling with the setting in both your app target and the Pods targets, to see where exactly @shsteven meant.

@alloy These are all in Pods targets.

All of the pods are pointing to github, compiling from source files (no pre-compiled binary)

I think that the issue is that if the Pod includes a static library like in this case https://github.com/CocoaPods/Specs/blob/master/AdMob/6.5.0/AdMob.podspec#L18 and the static library is not compiled for all the needed architectures the compilation of the user target will fail.

@alloy I was trying to reproduce the issue by copying the Podfile in question to a fresh project and perform a "pod install"

However, that works perfectly! No tweaking build settings at all.

@shsteven I switched to NO in Build Active Architecture Only and it didn't work

now the problem is again architecture when I target the device

Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'armv7' didn't contain all required architectures 'armv7 armv7s'

Ld /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7/Crazy\ Valet normal armv7
    cd /Users/pedropaulo/git/iphone/valet
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos -L/Users/pedropaulo/git/iphone/valet/Pods/AdMob -L/Users/pedropaulo/git/iphone/valet/Pods/ChartboostSDK/Chartboost -L/Users/pedropaulo/git/iphone/valet/Pods/GoogleAnalytics-iOS-SDK -L/Users/pedropaulo/git/iphone/valet/Pods/TestFlightSDK -F/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos -filelist /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7/Crazy\ Valet.LinkFileList -dead_strip /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos/libPods.a -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -lz -framework CoreData -weak_framework Twitter -weak_framework AdSupport -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework StoreKit -framework AudioToolbox -framework MessageUI -framework QuartzCore -framework SystemConfiguration -weak_framework GameKit -lPods -Xlinker -dependency_info -Xlinker /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7/Crazy\ Valet_dependency_info.dat -o /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7/Crazy\ Valet

clang: error: no such file or directory: '/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos/libPods.a'

Ld /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7s/Crazy\ Valet normal armv7s
    cd /Users/pedropaulo/git/iphone/valet
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos -L/Users/pedropaulo/git/iphone/valet/Pods/AdMob -L/Users/pedropaulo/git/iphone/valet/Pods/ChartboostSDK/Chartboost -L/Users/pedropaulo/git/iphone/valet/Pods/GoogleAnalytics-iOS-SDK -L/Users/pedropaulo/git/iphone/valet/Pods/TestFlightSDK -F/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos -filelist /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7s/Crazy\ Valet.LinkFileList -dead_strip /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos/libPods.a -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -lz -framework CoreData -weak_framework Twitter -weak_framework AdSupport -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework StoreKit -framework AudioToolbox -framework MessageUI -framework QuartzCore -framework SystemConfiguration -weak_framework GameKit -lPods -Xlinker -dependency_info -Xlinker /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7s/Crazy\ Valet_dependency_info.dat -o /Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Intermediates/Crazy\ Valet.build/Debug-iphoneos/Crazy\ Valet.build/Objects-normal/armv7s/Crazy\ Valet

clang: error: no such file or directory: '/Users/pedropaulo/Library/Developer/Xcode/DerivedData/Crazy_Valet-bjerqtsmyojsqlcbnwyzxirmvxdi/Build/Products/Debug-iphoneos/libPods.a'


@ppaulojr Your issue appears to be related to a mismatch between your settings and the ones of the Pods project. There is some discussion about it in the other issues.

I'm closing this ticket because unless proved otherwise the issue is related to the static libraries vendored by the projects and thus is not actionable in this repo.


@nt9 can you delete the specs branch from your CocoaPods repo as it is confusing Github and litters the issues with a reference like the one present above?

@ppaulojr

As @irrationalfab mentioned, it's possible that there are some default CocoaPods settings that you may have overridden. If you go to "Other Linker Flags" under "Build Settings" and hit the backspace key, this will reset your linker flag settings to the default pod settings.

I'd recommend saving your current settings before doing this and adding your settings back in one at a time to see which one is at fault.

Was this page helpful?
0 / 5 - 0 ratings