Cocoapods: 'ld: framework not found' recurrent issue in repository with XCode 8.2

Created on 16 Jan 2017  路  11Comments  路  Source: CocoaPods/CocoaPods

What did you do?

This is my podfile:

platform :ios, '9.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'

def base_pods
    pod 'GoogleAds-IMA-iOS-SDK-For-AdMob'
end

target 'testAdmob' do
  base_pods
end

  1. Run pod install
  2. Commit to repository
  3. Delete local repository
  4. Check out repository
  5. Build project
  6. Get error ld: framework not found GoogleMobileAds
  7. Comment out GoogleMobileAds pod
  8. Run pod update
  9. Uncomment GoogleMobileAds pod
  10. Run pod update
  11. Project builds
  12. Repeat step 3 and 4. You will be again at 5

What did you expect to happen?

I expect that the the project will build after checking out the repo without needing to comment and uncomment the pod.

This is important as we build via push to a remote that triggers a Jenkins build.

What happened instead?

Build always fails with ld: framework not found

CocoaPods Environment

Stack

   CocoaPods : 1.1.1
        Ruby : ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
    RubyGems : 2.4.8
        Host : Mac OS X 10.11.6 (15G1212)
       Xcode : 8.2.1 (8C1002)
         Git : git version 2.10.1 (Apple Git-78)
Ruby lib dir : /Users/TWC/.rvm/rubies/ruby-2.2.4/lib
Repositories :
               master - https://github.com/CocoaPods/Specs.git @ e2a71f2cd4ff873824a16f9cb75cf105c4bdb6f6

Installation Source

Executable Path: /Users/TWC/.rvm/gems/ruby-2.2.4/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.1
cocoapods-try         : 1.1.0

Project that demonstrates the issue

https://github.com/piterwilson/testAdmob

Most helpful comment

We found the problem for our case. Sourcetree was not detecting the diff of the executable and then couldn't reference the correct executable in the linking phase.

Doing a good ol' git status in the Terminal gave us the following

Changes not staged for commit:                                                                                                                                                                                      
        typechange: Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks/GoogleMobileAds.framework/GoogleMobileAds 

So yeah, we needed to stage the executable right there to make things work.

All 11 comments

Hi @piterwilson! I cloned your repo and ran pod install and got this message:

[!] Unable to satisfy the following requirements:

- `Google-Mobile-Ads-SDK (= 7.16.0)` required by `Podfile.lock`
- `Google-Mobile-Ads-SDK (~> 7.0)` required by `GoogleAds-IMA-iOS-SDK-For-AdMob (3.3.1)`

None of your spec sources contain a spec satisfying the dependencies: `Google-Mobile-Ads-SDK (= 7.16.0), Google-Mobile-Ads-SDK (~> 7.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

Would you mind double checking that it works from a fresh clone and fixing any issues to ensure it's reproducible in the way you mentioned? Let me know, and I'll go back and try again. Thanks!

Hi @benasher44

Thanks for your reply and looking into this.

Three things i have noted after your instructions:

1- My source repos WERE indeed outdated. After i ran pod repo update there was quite a lot of movement. For good measure, I uninstalled cocoapods entirely and then reinstalled it again. Turns out i had multiple versions of the cocoapods gem plus multiple versions of nanaimo.

2- After reading this https://guides.cocoapods.org/using/pod-install-vs-update.html i realised i had been using cocoapods all wrong and was never running pod install.

3- I corrected my ways, uninstalled cocoapods entirely and then reinstalled it again, made sure all my repos are up to date. Deleted the project repo and checked it out again. Then ran pod install this is my output:

Analyzing dependencies
Downloading dependencies
Using Google-Mobile-Ads-SDK (7.16.0)
Using GoogleAds-IMA-iOS-SDK-For-AdMob (3.3.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.

And when i build i still get :

ld: framework not found GoogleMobileAds

From what i can tell, GoogleAds-IMA-iOS-SDK-For-AdMob auto-installs the Google-Mobile-Ads-SDK dependency and i really dont understand why we have such different results to the same command and apparently equal setup.

Obviously, my setup is somehow broken, but if uninstalling and reinstalling cocapods and its master repo doesn't fix it, then what?

If i look at the podspec https://github.com/CocoaPods/Specs/blob/master/Specs/e/c/6/GoogleAds-IMA-iOS-SDK-For-AdMob/3.3.1/GoogleAds-IMA-iOS-SDK-For-AdMob.podspec.json I can see the GoogleMobileAds dependency

"dependencies": {
    "Google-Mobile-Ads-SDK": [
      "~> 7.0"
    ]
  }

And in the sample repo, that pod exists. Doesn't this mean that installing GoogleAds-IMA-iOS-SDK-For-AdMob automatically installs Google-Mobile-Ads-SDK ?

Any ideas are very appreciated.

Thanks for double checking on that! I'm still getting the same output though when I go run pod install after updating the master branch of your test repo. Can you make sure pod install works, and then I can try debugging the project? Thanks!

Can you make sure pod install works, and then I can try debugging the project?

I guess that's the point of the issue i'm reporting. I can't get pod install to work reliably, that is, to give you and me the same results using the same repository.

At this point i am working on the theory that my cocoapods installation (or the installation inside the project?) is somehow broken, and that the same fault has somehow been replicated on to other machines in my organisation.

If this was the case, how could i make sure to fix this? i already uninstalled/installed cocoapods and the same result occurs.

Ha you know what my local specs repo was out-of-date. I ran pod install --repo-update, and now I'm past pod install with your sample project. I'll dig in some more this afternoon. Sorry about that!

In your project, if you rm -rf Pods, and pod install, it'll build successfully. With a fresh checkout of your project, it wasn't working. After I did that, it built fine. Have a great day!

Again, thank you so much for having a look at this.

It is true that if you do rm -rf Pods and then pod install --repo-update the project will build.

However, after doing that, my git client (Sourcetree) sees no changes, which also means that after deleting the project and checking out again i am at exactly the same point i was before.

The problem is not being unable to get the project to build, but to get the project to build directly after checking out the project fresh (without rebuilding the Pods).

It is possible that my machine has some issue in its cocoapods installation or perhaps something else of that sort. But at the moment i'm still at ld: framework not found GoogleMobileAds with the only workaround being having to re-create the pods after checkout if i want to build.

It is strange that whatever happened to my computer also happened to the remote servers that pull the project to build the app, though.

Thanks though for looking and showing me a more elegant way to rebuild the pods. Even though the issue remains a mystery, i can say have learned a lot.

Hm. If you try with CocoaPods 1.2.0.rc.1, there were quite a few changes in git to the Pods directory for me. I believe the full CP 1.2.0 version will be released soon, but you can get the RC by doing gem install cocoapods --pre or by specifying it in your Gemfile.

The same problem we are facing too, did you get any solutions? We have tried commit with pod directory as well as without pod directory and pod update also..nothing seems to be working.
Help appreciated.

We are running into a _similar_ problem, I would say. If I do a pod install locally, everything works fine. If I check out the source code on a different client and then try to run our app it fails with the framework not found error. Interestingly though, up until version 7.24.1 this problem did not occur. Only when I tried to update to the latest version yesterday, 7.27.0.
I'll try out with the versions before 7.27.0, but we at least want the 7.26.0 version since it includes support for the iPhone X.

@karthisiva ever solved the issue?

We found the problem for our case. Sourcetree was not detecting the diff of the executable and then couldn't reference the correct executable in the linking phase.

Doing a good ol' git status in the Terminal gave us the following

Changes not staged for commit:                                                                                                                                                                                      
        typechange: Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks/GoogleMobileAds.framework/GoogleMobileAds 

So yeah, we needed to stage the executable right there to make things work.

Was this page helpful?
0 / 5 - 0 ratings