-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
🐛 'folly/Optional.h' file not found on Xcode version 12.5 #195
Comments
This might be related to the following line: https://github.com/cuvent/react-native-vision-camera/blob/26cf21ff5f79d98c37b80e4e488ae01d02248448/VisionCamera.podspec#L46 could you try removing it, running pod install, and then seeing if that fixes it for you? There might be some additional imports missing which you have to the Podfile, for example React-callinvoker. |
You could try editing - s.dependency "React"
+ s.dependency 'ReactCommon/turbomodule/core'
+ s.dependency 'Folly' then in your own
to the top. Here's an example podspec that should work. Let me know if that fixes the issue for you because I cannot reproduce it. |
I was able to make it work but I had to set
|
Playing around solution suggested by @axeldelafosse I was able to build it without touching RN codebase. To make work with RN 0.63We need to do two changes in the module. First one in # filename: VisionCamera.podspec
+ folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
+ folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
+ folly_version = '2020.01.13.00'
+ boost_compiler_flags = '-Wno-documentation'
...
s.requires_arc = true
+ s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
+ s.xcconfig = {
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
+ "HEADER_SEARCH_PATHS" => "$(inherited) \"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
+ "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags
+ }
...
- s.dependency "React-callinvoker"
- s.dependency "React"
- s.dependency "React-Core"
+ s.dependency "React-callinvoker"
+ s.dependency "React-Core"
+ s.dependency "ReactCommon/turbomodule/core"
+ s.dependency "Folly", folly_version Also this simple change in - if (RCTTurboModuleBlockCopyEnabled()) {
+ if (RCTTurboModuleEnabled()) { Then in your main Podfile: - config = use_native_modules!
- use_react_native!(:path => config["reactNativePath"])
+ config = use_native_modules!
+ reactNativePath = config["reactNativePath"] ||= "../node_modules/react-native"
+ use_react_native!(:path => reactNativePath)
...
+ pod 'ReactCommon/turbomodule/core', :path => "#{reactNativePath}/ReactCommon", :modular_headers => true
+ pod 'Folly', :podspec => "#{reactNativePath}/third-party-podspecs/Folly.podspec", :modular_headers => true P.S: The fixed Folly version is extracted from RN0.63 release notes. I just kept it based on @axeldelafosse suggestion and RNReanimated podscec. To make work with RN 0.64 using changes above 👆🏻Basically we just need to change # filename: VisionCamera.podspec
- "HEADER_SEARCH_PATHS" => "$(inherited) \"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
+ "HEADER_SEARCH_PATHS" => "$(inherited) \"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
...
- s.dependency "Folly", folly_version
+ s.dependency "RCT-Folly", folly_version Also in your main Podfile: - pod 'Folly', :podspec => "#{reactNativePath}/third-party-podspecs/Folly.podspec", :modular_headers => true
+ pod 'RCT-Folly', :podspec => "#{reactNativePath}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true 👉🏻 ...However I believe that we don't have problem now with 0.64 version. I"ll update the PR #273 to make these changes only in 0.63 version. What you guys think? PS: I don't understand why we need to switch from Folly to RTC-Folly as I didn't find anything in the release notes. But it works. To make work with Expo 42 as a Config Plugin in Managed WorkflowExpo 42 uses RN 0.63. Using That's it! If anyone still has problems just share it! ✌️ |
Wow, amazing research @matheusmatos and @axeldelafosse! 😲🤩 I'll research a bit more on what those Modular Headers are exactly and if there's any workaround because I can't sleep good at night if we patch the user's Podfile like that (adjusting RN pods), but if not we'll use those changes! |
Swift Pods require the use of [modular headers](https://blog.cocoapods.org/CocoaPods-1.5.0/) to be statically linked. To interop with Objective-C modules, you need to make the Objective-C module "define a Module", that is modular header export. This is already the case for a few podspecs so they can be consumed in Swift libraries, but `ReactCommon` doesn't do this yet and therefore breaks in a few libraries of mine, for example see this issue: mrousavy/react-native-vision-camera#195. If I were to include `ReactCommon` in my Swift library's podspec, the following error arises: ``` [!] The following Swift pods cannot yet be integrated as static libraries: The Swift pod `VisionCamera` depends upon `RCT-Folly`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies. ``` So this PR fixes this issue by allowing Swift libraries to consume the `ReactCommon` podspec since it now exports modular headers.
Maybe this fixes things for the future: facebook/react-native#31858 |
So as far as I know, Expo 43 will come with React Native 0.64, which fixes all those build issues. |
Just found a commit that fixes this issue (I believe) and it made it to RN 0.65! facebook/react-native@8aea930 |
Gosh this is all so fragile in the build process :( |
After updating React Native to 0.73.4, I am seeing the following: 'Pods/Headers/Public/RCT-Folly/folly/Optional'.h:474:36 Binary expression ('const bool' and 'const std::nullopt_t') has invalid operands.can help in resolving. |
facebook#31858) Summary: <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. --> ## Summary Swift Pods require the use of [modular headers](https://blog.cocoapods.org/CocoaPods-1.5.0/) to be statically linked. To interop with Objective-C modules, you need to make the Objective-C module "define a Module", that is modular header export. This is already the case for a few podspecs so they can be consumed in Swift libraries, but `ReactCommon` and `RCT-Folly` don't do this yet and therefore this breaks in a few libraries of mine, for example see this issue: mrousavy/react-native-vision-camera#195. If I were to include `ReactCommon` or `RCT-Folly` in my Swift library's podspec, the following error arises: ``` [!] The following Swift pods cannot yet be integrated as static libraries: The Swift pod `VisionCamera` depends upon `RCT-Folly`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies. ``` So this PR fixes this issue by allowing Swift libraries to consume the `ReactCommon` and `RCT-Folly` podspecs since they now export modular headers. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Expose Modular Headers for `ReactCommon` podspec [General] [Fixed] - Expose Modular Headers for `RCT-Folly` podspec Pull Request resolved: facebook#31858 Test Plan: * Add s.dependency "ReactCommon" or RCT-Folly to a Swift pod and see what happens. (See mrousavy/react-native-vision-camera#273) Differential Revision: D54539127 Pulled By: cipolleschi
#43327) Summary: Pull Request resolved: #43327 <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. --> ## Summary Swift Pods require the use of [modular headers](https://blog.cocoapods.org/CocoaPods-1.5.0/) to be statically linked. To interop with Objective-C modules, you need to make the Objective-C module "define a Module", that is modular header export. This is already the case for a few podspecs so they can be consumed in Swift libraries, but `ReactCommon` and `RCT-Folly` don't do this yet and therefore this breaks in a few libraries of mine, for example see this issue: mrousavy/react-native-vision-camera#195. If I were to include `ReactCommon` or `RCT-Folly` in my Swift library's podspec, the following error arises: ``` [!] The following Swift pods cannot yet be integrated as static libraries: The Swift pod `VisionCamera` depends upon `RCT-Folly`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies. ``` So this PR fixes this issue by allowing Swift libraries to consume the `ReactCommon` and `RCT-Folly` podspecs since they now export modular headers. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Expose Modular Headers for `ReactCommon` podspec [General] [Fixed] - Expose Modular Headers for `RCT-Folly` podspec Pull Request resolved: #31858 Test Plan: * Add s.dependency "ReactCommon" or RCT-Folly to a Swift pod and see what happens. (See mrousavy/react-native-vision-camera#273) Reviewed By: dmytrorykun Differential Revision: D54539127 Pulled By: cipolleschi fbshipit-source-id: 2291cc0c8d6675521b220b02ef0c3c6a3e73be38
#43327) Summary: Pull Request resolved: #43327 <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. --> ## Summary Swift Pods require the use of [modular headers](https://blog.cocoapods.org/CocoaPods-1.5.0/) to be statically linked. To interop with Objective-C modules, you need to make the Objective-C module "define a Module", that is modular header export. This is already the case for a few podspecs so they can be consumed in Swift libraries, but `ReactCommon` and `RCT-Folly` don't do this yet and therefore this breaks in a few libraries of mine, for example see this issue: mrousavy/react-native-vision-camera#195. If I were to include `ReactCommon` or `RCT-Folly` in my Swift library's podspec, the following error arises: ``` [!] The following Swift pods cannot yet be integrated as static libraries: The Swift pod `VisionCamera` depends upon `RCT-Folly`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies. ``` So this PR fixes this issue by allowing Swift libraries to consume the `ReactCommon` and `RCT-Folly` podspecs since they now export modular headers. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Expose Modular Headers for `ReactCommon` podspec [General] [Fixed] - Expose Modular Headers for `RCT-Folly` podspec Pull Request resolved: #31858 Test Plan: * Add s.dependency "ReactCommon" or RCT-Folly to a Swift pod and see what happens. (See mrousavy/react-native-vision-camera#273) Reviewed By: dmytrorykun Differential Revision: D54539127 Pulled By: cipolleschi fbshipit-source-id: 2291cc0c8d6675521b220b02ef0c3c6a3e73be38
What
Can't run on Xcode v12.5, it shows 'folly/Optional.h' file not found.
Not sure if it's related to facebook/flipper#2215
Logs
Reproducable sample
Environment
The text was updated successfully, but these errors were encountered: