-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Header maps can lead to one pod leaking its headers to another pod #9248
Comments
CocoaPods does not generate any header maps. This happens from Xcode and the default setting for |
I don't think that works if some Pods depend on If an app depends upon two Pods that both use the same header name and at least one of the Pods depends on |
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍 |
## Description The problem very well described [here](CocoaPods/CocoaPods#9248) (Freeform description section) ## Possible solution - turn off USE_HEADERMAPS - move header file to `preserved_paths`
Report
What did you do?
Created a
Podfile
that contains two pods that demonstrate the issue with headermaps.What did you expect to happen?
Generate a workspace that can build successfully.
What happened instead?
Workspace is misconfigured and fails compilation.
CocoaPods Environment
Stack
Installation Source
Plugins
Podfile
Project that demonstrates the issue
HeaderMapRepro.zip
Freeform description
Under certain circumstances, pods might end up leaking headers into other pods.
The issue is that the generated Xcode workspace uses a header map that contains headers from all the pods. If two pods happen to contain a header with the same short name, the header map will only contain a single entry for that short name, so that one of the headers will "shadow" the other. This will lead to a broken build if one of the pods relies on the ability to import headers using just their short name.
In order for the issue to manifest, the following is necessary:
util.h
, and that header is part of itssource_files
in the podspec;util.h
;util.h
by its short name, e.g. by doing#import "util.h"
.The results are:
Pod-B-project-headers.hmap
which will contain entries for all the pods used in the project;Pod-B-project-headers.hmap
will only contain a single entry forutil.h
, which may be either the header from pod A or else the header from pod B (I presume it's effectively random which one ends up in the map);util.h
to pod A, building pod B will fail upon trying to include a header from pod A.The repro case is a simple Xcode project with a
Podfile
containing two pods that happen to trigger the issue. Using the names above, "Pod A" isFirebaseFirestore
, and "Pod B" isSVGKit
. Firestore contains a header nameddocument.h
, which leaks into SVGKit and shadows its ownDocument.h
, leading to a build error. The generated header map looks like this.I can confirm that running the failing compilation command from Xcode in command line will succeed if I remove
-I
flag that includes the problematic header map (SVGKit-project-headers.hmap
).Is it possible for CocoaPods to avoid generating the
project-headers.hmap
? It seems that because header maps essentially are unable to handle collisions, using a header map that contains entries for more than one pod is pretty much guaranteed to fail for some combinations of pods.Our customers have recently encountered this issue in Firestore. I have found the exact same problem previously affecting React Native and Folly.
Please let me know if any additional information would be helpful.
The text was updated successfully, but these errors were encountered: