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

Duplicate symbols when including runtime via cocoapods #10

Closed
adamawolf opened this issue Jun 6, 2014 · 7 comments
Closed

Duplicate symbols when including runtime via cocoapods #10

adamawolf opened this issue Jun 6, 2014 · 7 comments

Comments

@adamawolf
Copy link

When I add

pod 'ProtocolBuffers', '1.2'

to an existing Podfile, all of the ProtocolBuffers runtime's .m files end up being included multiple times in Pods.xcodeproj's Build Phases->Compile Sources section. Deleting the duplicate .m files from this list fixes the issue.

An possible explanation is this Podfile uses the "link_with" directive with a list of two targets (one the main app target, and one is the test target).

E.g. we have something like:

link_with 'App', 'AppTests' 
@adamawolf
Copy link
Author

This seems relevant, and probably points to your Cocoapods configuration as not being the issue.

CocoaPods/CocoaPods#1729

@adamawolf
Copy link
Author

Scratch that, this does seem to be a protobuf-objc issue. Even doing a pod install with the simplest Podifle possible double includes the .m files:

platform :ios, '6.0'

xcodeproj 'TestProject/TestProject'

pod 'ProtocolBuffers', '1.2'

screen shot 2014-06-06 at 3 18 28 pm

@alexeyxo
Copy link
Owner

alexeyxo commented Jun 6, 2014

Do you mean this?

echo -e "platform :ios , 6.0 \nlink_with '<YourAppTarget>', '<YourAppTarget_Test>' \npod 'ProtocolBuffers', '1.2.1' " > Podfile

@adamawolf
Copy link
Author

For the most part... yes. Except there's no v1.2.1 available via cocoa pods, and using the echo command overwrites our existing Podfile. We simply add

pod 'ProtocolBuffers', '1.2'

to the existing Podfile file in the root of our project.

@adamawolf
Copy link
Author

I'm not very knowledgeable about cocoapods spec files, but the problem seems to be your non-arc sub spec. I don't think it's doing what you want: when I include your cocoapod as

pod 'ProtocolBuffers/non-arc', '1.2.1'

I don't get duplicate .m files in the Compile Sources, and I simply get the normal arc versions of the files (so, for the time being this is a work around for getting the ARC version of the runtime vie cocoa pod).

I suspect the

"source_files": "src/runtime/Classes/*.{h,m}"

of the root podspec and of the non-arc subspec are aggregating and including all of the source files twice.

alexeyxo added a commit that referenced this issue Jun 7, 2014
@alexeyxo
Copy link
Owner

alexeyxo commented Jun 7, 2014

version 1.2.2 is available now

-> ProtocolBuffers (1.2.2)
   Protocol Buffers for Objective-C
   pod 'ProtocolBuffers', '~> 1.2.2'
   - Homepage: http://protobuf.axo.io
   - Source:   https://github.com/alexeyxo/protobuf-objc.git
   - Versions: 1.2.2, 1.2.1, 1.2 [master repo]
   - Sub specs:
     - ProtocolBuffers/non-arc (1.2.2)

@adamawolf
Copy link
Author

Confirming: v 1.2.2 does not have the duplicate symbol issue. Thanks Alexey!

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

2 participants