Daniel Ryan
Daniel Ryan

Reputation: 7100

Adding Google Analytics to my podfile breaks the build (library not found)

I have Google Analytics in my project which works fine. Once I move it to my pod file everything breaks.

In my pod:

pod 'Google/Analytics', '~> 1.0.0'  
pod 'Google-Mobile-Ads-SDK'

The pod update log:

Installing Google (1.0.7)
Using Google-Mobile-Ads-SDK (7.3.1)
Installing GoogleAnalytics (3.12.0)
Installing GoogleNetworkingUtilities (1.0.0)
Installing GoogleSymbolUtilities (1.0.0)
Installing GoogleUtilities (1.0.1)

I get this error:

ld: library not found for -liPhone-lib clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've noticed it breaks and spams the "library search paths" in the build settings.

Broken library search paths

I have Google ads SDK in my pod file and that has been working fine.

Anyone know what is wrong here? If it's a bug then whose fault it would be?

Edit: Updated to Cocoapods to 0.38.2, no change.

In my pod xcconfig file, the var "LIBRARY_SEARCH_PATHS" gets edited when I include Google Analytics and it removes "$(inherited)":

Example:

LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/Google/Libraries" "$(PODS_ROOT)/Google/Libraries" "$(PODS_ROOT)/GoogleAnalytics/Libraries" "$(PODS_ROOT)/GoogleNetworkingUtilities/Libraries" "$(PODS_ROOT)/GoogleNetworkingUtilities/Libraries" "$(PODS_ROOT)/GoogleSymbolUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries" "$(PODS_ROOT)/GoogleUtilities/Libraries"

It looks to be a bug.

Edit 2: I have created a bug report here: https://github.com/CocoaPods/CocoaPods/issues/3908

Upvotes: 5

Views: 5210

Answers (3)

AlQaim Solutions
AlQaim Solutions

Reputation: 69

Select the product -> Go to edit scheme -> select build -> and finally add pods.

Upvotes: 0

Daniel Ryan
Daniel Ryan

Reputation: 7100

I have created a bug report here: https://github.com/CocoaPods/CocoaPods/issues/3908

They agreed it was a bug so the best solution is to wait until it is fixed.

I believe I could hack to add "$(inherited)" to get it working but personally I'll pass on this.

Edit: Bug was fixed and released. No more problems.

Upvotes: 1

SwiftArchitect
SwiftArchitect

Reputation: 48522

Trying your setup as described on a brand new Xcode project, and using the Podfile as below, there is no such error.

First suggestion: Make a new project, pod init, add your Pod requirements, pod install, build, link and run.

target 'GooglePod' do
pod 'Google/Analytics', '~> 1.0.0'  
pod 'Google-Mobile-Ads-SDK'
end

target 'GooglePodTests' do

end

Second suggestion:

Verify the configurations.

enter image description here

Upvotes: 2

Related Questions