Closed meritozh closed 6 years ago
They are all #import
directives, so the compiler make sure to only load the contents once. I'm not completely clear from you description what you are doing, but it sounds like you might be making your own packaging around a few pods? The one that could cause problems is if you are finding the headers via different imports and hence finding them in different spots. GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
is used to make the protobuf header use the #import <Protobuf/[name].h
imports. The podpsec helps do this via some *_target_xcconfig
directives. If you are manually setting up a target, you could have added an include path into the objectivec/google/protobuf
subdirectory instead of setting up the GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
and that is causing the compiler to think there are multiple headers trying to define the same things.
Yes, I package several pods into one. I don't know how to describe it in detail.
I know Clang will only load header once if it load through #import
. I just sort headers then hand code content of explicit module Protobuf
in module.modulemap, it can not compile, but if I move header "Any.pbobjc.h"
to last line, it can compile. I don't think headers order in modulemap can affect module parsing result, success or not. If I disable clang module, it can compile. Or comment this line, it also can compile: https://github.com/google/protobuf/blob/e34ec6077af141dd5dfc1c334ecdcce3c6b51612/objectivec/GPBProtocolBuffers.h#L44
Defining GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
won't affect result, I have change header path manually.
By process of elimination, I think circular header inclusion may cause some internal error when Clang parsing module. Also I need more testing, will update this issue if I have any process.
@thomasvl I test with a demo project. It seem circular inclusion will actually cause module parsing problem. Xcode raise error cannot find interface declaration for 'GPBAny'
. Demo is here: https://github.com/meritozh/CircularIncludeTest
no response?
no response?
Sorry, I don't think any of us that work on Apple platforms has gotten a chance to dig into this more and other things we work on have been higher priority.
My thought is since the pod has been around for a while without this coming up, it likely is specific to your setup and less likely to be a general problem.
The issue is open so if other people run into it they can also chime in and anyone looking to contribute could try looking at it also.
Thanks. I'm interested in this problem. Maybe I will make a PR to fix it if I find a proper solution.
Seems there is a circular header inclusion problem:
It can compile through
pod 'Protobuf'
, but if I pre build several pods, include this pod, then combine them into one static library, wrap and produce an final static core.framework with custommodule.modulemap
, it can not work. Xcode raise two errorcould not build module core
andcannot find interface declaration for 'GPBAny'
.module.modulemap: