Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analytics 4.1.3 Error In CocoaPods Update #989

Closed
rwgrier opened this issue Mar 4, 2021 · 10 comments
Closed

Analytics 4.1.3 Error In CocoaPods Update #989

rwgrier opened this issue Mar 4, 2021 · 10 comments

Comments

@rwgrier
Copy link

rwgrier commented Mar 4, 2021

I am attempting to update from Analytics 4.1.2 to 4.1.3, and when I do a pod update, I get the following error in the console:

[!] The 'Pods-xxxxxxx' target has transitive dependencies that include statically linked binaries: (Analytics)

My Podfile has the use_frameworks! flag set, I do not have use_frameworks! :linkage => :static in my Podfile. I even tried use_frameworks! :linkage => :dynamic and that did not work. I receive the same error every time I attempt to update.

CocoaPods: 1.10.1
Xcode: 12.4 (12D4e)
Platform version (in the Podfile): platform :ios, '11.0'

Am I missing an obvious step here? Any guidance would be helpful.

@iujames
Copy link

iujames commented Mar 5, 2021

+1 this update appears to have broken our ability to update the segment pod, with no clear workaround (also similar to #968 (comment))

@Noobish1
Copy link

Noobish1 commented Mar 8, 2021

I'm seeing this also with an internal Cocoapod. (I'm the commentor that @jellis-fox mentions above). #968 seems to be the change that caused this.

@wvabrinskas
Copy link

wvabrinskas commented Mar 8, 2021

+1 to this.

I am also having this issue. Same environment. Setting use_frameworks! :linkage => :static is not a valid solution for us as this results in a runtime error where the app can't find another dependency.

@sergiymomot
Copy link

It happens if you also have any Segment integration pods integrated in addition to Segment SDK.

Reason: if an app links multiple dynamic libraries that include the same static library, the app will get undefined behavior, since there will be multiple copies of the same static library. Meaning that Segment will be statically linked to your to app and also be statically linked to dynamic Segment Integration pod (also linked to your app), thus duplication of symbols.

Workaround: link Segment integration pods manually by just copying source files into your project instead of using Cocoapods. Not ideal, of course, but hopefully Segment integration pods authors will update their repos to fix this problem.

@cf-lam
Copy link

cf-lam commented Mar 19, 2021

@sergiymomot I tried including Segment directly into my dynamic framework by copying all the objective-c files from the Segment source code into my framework target. However, I couldn't build the framework because I kept running into an error about "include of non-modular header inside framework module" when I tried to use Segment in my Swift files within the same framework. Looked at https://stackoverflow.com/a/37072619/15261204. Basically I have a dynamic framework that I include in my app target as well as other dynamic frameworks, and I want to be able to use Analytics everywhere and am running into runtime issues where it says duplicate symbols are found. Those issues are due to Analytics now being a static library that I am including in multiple dynamic frameworks, which causes the Analytics code to be copied for each of those dynamic framework targets.

@cf-lam
Copy link

cf-lam commented Mar 19, 2021

I was running into a runtime issue related to using CocoaPods to include Analytics in a dynamic framework that I then included as a framework dependency for other dynamic frameworks and an app target. I was getting runtime errors about duplicate symbols found.

Dependency looked like this:

Shared.framework <-- Feature.framework

Shared.framework <-- App target
Feature.framework <-- App target

Podfile looked like this:

shared_pods
    pod Analytics
    .... other pods
end

target 'Shared' do
    project 'Shared/Shared.xcodeproj'
    shared_pods
end

target 'Feature' do
    project 'Feature/Feature.xcodeproj'
    shared_pods
    .... other pods
end

target 'App' do
    shared_pods
    main_project_pods
    .... other pods
end

The fix was not to include pod analytics for all the other frameworks and targets, just Shared, so that Podfile looks like

shared_pods
    .... other pods
end

target 'Shared' do
    project 'Shared/Shared.xcodeproj'
    shared_pods
    pod Analytics
end

target 'Feature' do
    project 'Feature/Feature.xcodeproj'
    shared_pods
    .... other pods
end

target 'App' do
    shared_pods
    main_project_pods
    .... other pods
end

This fix only works because I use Segment code in my swift files only inside the Shared framework. I create wrapper classes around Segment in Shared, and my other framework and app targets reference these wrapper classes and not the Analytics library directly.

@bsneed
Copy link
Contributor

bsneed commented Apr 21, 2021

Looking into this today, FYI.

@dhiren92
Copy link

+1 this update appears to have broken our ability to update the segment pod

1 similar comment
@anuvednayakzc
Copy link

+1 this update appears to have broken our ability to update the segment pod

@bsneed
Copy link
Contributor

bsneed commented Apr 27, 2021

Will close this because it's a duplicate. Please follow #991 for progress.

@bsneed bsneed closed this as completed Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants