protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

CocoaPods Protobuf umbrella header issue

Open UInt2048 opened this issue 5 years ago • 8 comments

What version of protobuf and what language are you using? Version: 3.12.0, 4.0.0-rc1 Language: Objective-C

What operating system (Linux, Windows, ...) and version? macOS 10.15.6

What runtime / compiler are you using (e.g., python version or gcc version) Xcode 11.6.0

What did you do? Steps to reproduce the behavior: Import the generated umbrella header: #import <Protobuf-umbrella.h>

What did you expect to see Everything build normally - or at least without straight-up errors, just as it would if the project did not use it.

What did you see instead? This error and three other like errors:

❌  /Users/distiller/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:48:11: duplicate interface definition for class 'GPBAnyRoot'

GPB_FINAL @interface GPBAnyRoot : GPBRootObject

I suspect the error is due to the umbrella header importing both GPBAny and Any, et cetera.

Anything else we should know about your project / environment This error did not occur before the upgrade to 3.12.0.

UInt2048 avatar Aug 02 '20 17:08 UInt2048

Is there a longer version of the error message? Does it say where it things both definitions come from?

@paulb777 any ideas?

Is the old file imports the new, I would have hoped there was only a single definition to be seen.

thomasvl avatar Aug 03 '20 19:08 thomasvl

Does using module syntax make a difference? @import Protobuf;?

A reproducible example would be helpful.

paulb777 avatar Aug 03 '20 20:08 paulb777

@thomasvl No problem. Here's an example: https://github.com/UInt2048/tsurukame/commit/dd7146e9800e554c86513c300d444c9b7d63bec9

Here's a screenshot: Sample

@paulb777 Using module syntax would likely work - the issue is only with the umbrella header. However, the compiler complains about C++ modules being disabled, so I can't directly answer.

It works normally without it (I have converted the file in question to Swift already in the main branch)

UInt2048 avatar Aug 06 '20 14:08 UInt2048

The screenshot doesn't actually provide the details that are in the Xcode log. All the screen shot has is "Previous definition is here", and you'd have to click on it to see where. The text in the build log would have everything.

thomasvl avatar Aug 06 '20 18:08 thomasvl

@thomasvl How could I share the full build log? Sometimes I would love to actually see it.

I did provide an example commit (admittedly a much larger example than the theoretical smallest possible)

UInt2048 avatar Aug 07 '20 00:08 UInt2048

@thomasvl How could I share the full build log? Sometimes I would love to actually see it.

Expand open the log and you can copy the text. Here's an example of getting some of it: https://stackoverflow.com/questions/30060898/xcode-how-to-see-build-command-and-log

I did provide an example commit (admittedly a much larger example than the theoretical smallest possible)

I don't think @paulb777 or I have had the chance to look. Yes, it is a commit, but since we aren't familiar with the project theres a bit of a curve since it appears to be Go code, so for someone to look, they have to figure out the build process, what are the dependencies, etc. Since this is a cocoapods issue, it wasn't immediately visible how that comes into play.

thomasvl avatar Aug 07 '20 13:08 thomasvl

Based on what you shared, here's the relevant portion of the build log, as experienced again in a different commit on macOS 10.13.6 on Protobuf 3.13.0:

CompileC /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Objects-normal/i386/Settings.o Settings.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/matthewbenedict/Documents/GitHub/tsurukame/ios
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fmodule-name=Tsurukame -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DDEBUG=1 -DCOCOAPODS=1 -DDEBUG=1 -DGPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=8.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wunguarded-availability -fobjc-abi-version=2 -fobjc-legacy-dispatch -index-store-path /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Index/DataStore -iquote /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Tsurukame-generated-files.hmap -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Tsurukame-own-target-headers.hmap -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Tsurukame-all-non-framework-target-headers.hmap -ivfsoverlay /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/all-product-headers.yaml -iquote /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Tsurukame-project-headers.hmap -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/include -I. -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Charts/Charts.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/FMDB/FMDB.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Haneke/Haneke.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Light-Untar/Light_Untar.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/MMDrawerController/MMDrawerController.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Reachability/Reachability.framework/Headers -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/DerivedSources/i386 -I/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/DerivedSources -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Charts -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/FMDB -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Haneke -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Light-Untar -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/MMDrawerController -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf -F/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Reachability -isystem /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Haneke/Haneke.framework/Headers -isystem /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Charts/Charts.framework/Headers -isystem /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Light-Untar/Light_Untar.framework/Headers -isystem /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/MMDrawerController/MMDrawerController.framework/Headers -iframework /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Haneke -iframework /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Charts -iframework /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Light-Untar -iframework /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/MMDrawerController -MMD -MT dependencies -MF /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Objects-normal/i386/Settings.d --serialize-diagnostics /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Objects-normal/i386/Settings.dia -c /Users/matthewbenedict/Documents/GitHub/tsurukame/ios/Settings.m -o /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Intermediates.noindex/Tsurukame.build/Debug-iphonesimulator/Tsurukame.build/Objects-normal/i386/Settings.o

In file included from /Users/matthewbenedict/Documents/GitHub/tsurukame/ios/Settings.m:15:
In file included from Settings.h:18:
In file included from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/Protobuf-umbrella.h:13:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:48:11: error: duplicate interface definition for class 'GPBAnyRoot'
GPB_FINAL @interface GPBAnyRoot : GPBRootObject
          ^
In module 'Protobuf' imported from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:11:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:48:22: note: previous definition is here
GPB_FINAL @interface GPBAnyRoot : GPBRootObject
                     ^
In file included from /Users/matthewbenedict/Documents/GitHub/tsurukame/ios/Settings.m:15:
In file included from Settings.h:18:
In file included from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/Protobuf-umbrella.h:13:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:139:11: error: duplicate interface definition for class 'GPBAny'
GPB_FINAL @interface GPBAny : GPBMessage
          ^
In module 'Protobuf' imported from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:11:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:139:22: note: previous definition is here
GPB_FINAL @interface GPBAny : GPBMessage
                     ^
In file included from /Users/matthewbenedict/Documents/GitHub/tsurukame/ios/Settings.m:15:
In file included from Settings.h:18:
In file included from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/Protobuf-umbrella.h:13:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:170:66: error: property has a previous declaration
@property(nonatomic, readwrite, copy, null_resettable) NSString *typeURL;
                                                                 ^
In module 'Protobuf' imported from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:11:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:170:66: note: property declared here
@property(nonatomic, readwrite, copy, null_resettable) NSString *typeURL;
                                                                 ^
In file included from /Users/matthewbenedict/Documents/GitHub/tsurukame/ios/Settings.m:15:
In file included from Settings.h:18:
In file included from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/Protobuf-umbrella.h:13:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:173:64: error: property has a previous declaration
@property(nonatomic, readwrite, copy, null_resettable) NSData *value;
                                                               ^
In module 'Protobuf' imported from /Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:11:
/Users/matthewbenedict/Library/Developer/Xcode/DerivedData/Tsurukame-drmqpxqbikatxibyigvtqzlahpxy/Build/Products/Debug-iphonesimulator/Protobuf/Protobuf.framework/Headers/GPBAny.pbobjc.h:173:64: note: property declared here
@property(nonatomic, readwrite, copy, null_resettable) NSData *value;
                                                               ^
4 errors generated.

UInt2048 avatar Dec 03 '20 22:12 UInt2048

Sorry for the long delay. Are you still seeing this error in newer versions of protobuf?

deannagarcia avatar Jul 26 '22 16:07 deannagarcia

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Mar 10 '24 10:03 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Mar 24 '24 10:03 github-actions[bot]