Skip to content

In a CocoaPod build, "Optional.h" will refer to folly/Optional.h unexpectedly #14326

Description

@mhorowitz

Description

The CocoaPods setup works, but there are issues integrating it into larger projects. In particular, header files from folly (and maybe elsewhere?) pollute the user header filespace, and I don't know why.

Reproduction Steps and Sample Code

  1. check out https://github.com/mhorowitz/native-navigation-boilerplate and apply this:
diff --git a/ios/Podfile b/ios/Podfile
index 3474dc5..556aa68 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -26,6 +26,8 @@ target 'ReactNativeStarter' do
     'DevSupport'
   ]

+  pod 'KSCrash'
+
   # Add any other dependencies here, including any 3rd party native libraries that you depend on for
   # React Native.
 end
  1. To run pod and open in Xcode:
cd ios
pod install
open ReactNativeStarter.xcworkspace
  1. Build it in Xcode. it will fail, probably in KSCrash's Demangle.cpp with an error about llvm::Optional. If you dig into this, you will eventually figure out that it is including folly/Optional.h instead. Xcode is generating a header map like .../DerivedData/ReactNativeStarter-bzdrkfxifzuvmgduxsjbskaldaxw/Build/Intermediates/Pods.build/Debug-iphonesimulator/KSCrash.build/KSCrash-project-headers.hmap which maps optional.h to Pods/Folly/folly/Optional.h, instead of the one inside KSCrash.

Solution

I have no idea. I am hoping someone who knows CocoaPods better than I can figure this out.

Additional Information

  • React Native version: 844a18f
  • Platform: iOS
  • Development Operating System: MacOS Sierra
  • Dev tools: Xcode 8.2.1, cocoapods 1.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: iOSiOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions