facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.29k stars 24.35k forks source link

Unable to find a specification for `Folly` depended upon by `React/CxxBridge` #14612

Closed zhunt11 closed 7 years ago

zhunt11 commented 7 years ago

Description

What I did:

I updated React Native to the latest version v0.45.1.

My package.json

"dependencies": {
        "react": "16.0.0-alpha.12",
        "react-native": "0.45.1",
        "react-native-vector-icons": "^4.1.1"
    },

What You Expect to Happen:

I expect to be able to build my iOS project without any errors.

What Actually Happened:

I have hundreds of errors in Xcode when building my project:

no such file or directory: 'node_modules/react-native/React/Modules/JSCSamplingProfiler.m' no such file or directory: 'node_modules/react-native/React/Base/RCTBatchedBridge.m' ...

Because of this breaking change (May 2017 Release Notes):

If you are using Cocoapods, you will have to update your Podfile by adding a dependency of ‘BatchedBridge’ or ‘CxxBridge’ to the React subspec depending on your choice.

I added CxxBridge to my Podfile:

pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'jschelpers',
  'cxxreact',
  'CxxBridge',
  'RCTText',
  'RCTNetwork',
  'RCTWebSocket', # needed for debugging
  'RCTActionSheet',
  'RCTAnimation',
  'RCTImage' ]

And when I run pod update or pod install I get:

[!] Unable to find a specification forFollydepended upon byReact/CxxBridge``

If I add BatchedBridge to my Podfile I get:

[!] Unable to find a specification forFollydepended upon byReact/jschelpers``

Solution

I am at a loss here. I need to get the latest version of React Native to build. I have no idea what Folly is or why it seems like it's a dependency of a dependency. Does anyone know how to resolve this?

I've tried pod install --repo-update, which also does not work.

Additional Information

mhorowitz commented 7 years ago

If you follow the link to the rev in the release notes, you'll see some additional instructions. You need to make some changes to your Podfile to add the third party CxxBridge dependencies. See https://github.com/mhorowitz/native-navigation-boilerplate/blob/master/ios/Podfile#L12-L14 for an example.

sivakumar-cf commented 7 years ago

@mhorowitz I followed this additional instructions. Now getting build error in limits file not found in folly library.

mhorowitz commented 7 years ago

What github revision are you building against? Does it include https://github.com/facebook/react-native/commit/f3f44eee59e8991e197c854e5fee719105c045cd? Please post the entire error output.

sivakumar-cf commented 7 years ago

I am using "react-native": "^0.45.1", and "react": "^16.0.0-alpha.12", which doesn't include the commit f3f44ee.

screen shot 2017-06-21 at 11 34 07 am
mhorowitz commented 7 years ago

This should be fixed in https://github.com/facebook/react-native/commit/f3f44eee59e8991e197c854e5fee719105c045cd. Please try a revision which includes it to see if it fixed your problem.

sivakumar-cf commented 7 years ago

Still I got the same issue. I think this is related to this https://github.com/facebook/react-native/issues/14654.

brentmitchell25 commented 7 years ago

I am getting "fatal error: 'limits' file not found" as well.

mhorowitz commented 7 years ago

@sivakumar-cf can you post a detailed repro? What version of RN are you using? what's in your Podfile, and what else do I need to repro?

sivakumar-cf commented 7 years ago

@mhorowitz I am using react-native 0.45.1 and React16.0.0-alpha.12

target 'AppDemo' do
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'React', :path => './../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge',
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket',
    'RCTImage',
    'RCTNetwork',
    'DevSupport'
]

[
'Firebase',
'Firebase/Core',
'Firebase/RemoteConfig',
'Firebase/Messaging',
].each do |lib|
    pod lib
end

pod 'Fabric'
pod 'Crashlytics'
pod 'Branch'
pod 'GoogleMaps'
end

To reproduce the issue, Just do npm install , pod install and Xcode to build, throwing build error #include <limits> file not found in Folly Library project.

mhorowitz commented 7 years ago

This is a known problem, see issue #14326. The fix is not in react-native 0.45.1. That version will not work. You will need to build from master, or some other version past https://github.com/facebook/react-native/commit/f3f44eee59e8991e197c854e5fee719105c045cd which contains the fix.

There's a separate bug which requires use_frameworks! in your Podfile for compilation to succeed. I'm still working on that.

ragnorc commented 7 years ago

Any updates on a possible fix? Unable to install 0.45.1 with Pods

mhorowitz commented 7 years ago

Did you try the documented fallback? "If this doesn't work, you can continue to use the old bridge by adding a dependency of 'BatchedBridge' to the React subspecs in your Podfile"

ragnorc commented 7 years ago

@mhorowitz I tried the documented fallback but it didn't work. BatchedBridge will be removed soon. Is the separate bug which requires use_frameworks! gone or should we wait with upgrading RN from 0.44?

mhorowitz commented 7 years ago

The problem described in this issue is that when using the CxxBridge with CocoaPods, the third-party dependency pods need to be explicitly included in the Podfile. There's an example of this here: https://github.com/mhorowitz/native-navigation-boilerplate/blob/0cb090c6d67ffcb3b47b51e2f06a4253635ef797/ios/Podfile#L13-L16

There's also conversation in this thread about another issue with CocoaPods and the CxxBridge which is captured in issue https://github.com/facebook/react-native/issues/14326. If you are seeing build-time issues with #import or #include files, please comment there.

tirrorex commented 7 years ago

@mhorowitz instead of closing the issue couldn't you update react-native documentation ?

If i follow the documentation here : https://facebook.github.io/react-native/docs/integration-with-existing-apps.html I expect everything to work right out of the box when copying/pasting the podfile, i shouldn't have to google my error and go into a github issue to have the pods install properly.

This is not user friendly at all and should in my opinion be fixed (in the documentation i mean).

JeckChou commented 6 years ago

@mhorowitz I was use CxxBridge with React native 0.49.5 and I get below error when i compiler my xcode project Include of non-modular header inside framework module 'yoga.YGNodeList': '/Users/XXXPods/Folly/folly/portability/stdio.h' image my podfile setting

pod 'yoga', :path => react_native_path + '/ReactCommon/yoga'

# Third party deps
pod 'DoubleConversion', :podspec => react_native_path + '/third-party-podspecs/DoubleConversion.podspec'
pod 'GLog', :podspec => react_native_path + '/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => react_native_path + '/third-party-podspecs/Folly.podspec'

# You don't necessarily need all of these subspecs, but this would be a typical setup.
pod 'React', :path => react_native_path, :subspecs => [
'Core',
'CxxBridge',
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
'RCTImage',
'RCTNetwork',
# Add any other subspecs you want to use in your project
'DevSupport'
]

my react native setting

"dependencies": { "react": "16.0.0-beta.5", "react-native": "0.49.5" }, "devDependencies": { "babel-jest": "21.2.0", "babel-preset-react-native": "4.0.0", "jest": "21.2.1", "react-test-renderer": "16.0.0-beta.5" }, "jest": { "preset": "react-native" }

what can i do with this ? can you give me some suggesting?

xcode version : Version 9.1 (9B55) mac os: 10.12.6 sierra

thanks

SuperMutong commented 6 years ago

@JeckChou same error my project has a submodule , if i remove the submodule, not error, but i can't

JeckChou commented 6 years ago

@SuperMutong in my case, i fix it update my project build setting , search path -> header search path and swift compiler search path -> import paths all my doing is just remove $(SOURCE_ROOT)/Pods from variable and fix my problem wish can help someone stuck same error

ashishpatill commented 6 years ago

i wanted to learn react native and build something with it but instead i am debugging pod install errors

ValeriyKliuk commented 6 years ago

Description What I did: Followed the Integration with Existing Apps guide from https://facebook.github.io/react-native/docs/integration-with-existing-apps.html

package.json

{
  "name": "ReactExample",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.53.3"
  }
}

Podfile:

source 'https://github.com/CocoaPods/Specs.git'

# Required for Swift apps
platform :ios, '8.0'
use_frameworks!

# The target name is most likely the name of your project.
target 'ReactExample' do

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

end

What You Expect to Happen: I expect to install all dependencies from Podfile. I expect to be able to build my iOS project without any errors.

What Actually Happened:

pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `GLog` from `../node_modules/react-native/third-party-podspecs/GLog.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] Unable to find a specification for `boost-for-react-native` depended upon by `Folly`

Additional Information React Native: 0.53.3 React: 16.2.0 Platform: iOS 11.2 Development Operating System: macOS 10.12.6 Build tools: Xcode 9.2 pod: 1.4.0

robinkam commented 6 years ago

@ValeriyKliuk similar 'Unable to find a specification for boost depended upon by Folly' issue here. Have you resolved this issue?

ValeriyKliuk commented 6 years ago

@robinkam Not yet :( I was able to work with the following tutorial with React: 16.0.0-alpha.12 and React Native : ^0.47.1 : https://medium.com/@indu.pal/integrating-react-native-with-existing-ios-app-using-cocoapods-use-of-native-modules-9ed1f0fe504a

pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core', # Include this to enable In-App Devmenu if RN >= 0.43
  'RCTText',
  'BatchedBridge',
  'DevSupport',
  'RCTNetwork',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTWebSocket', # needed for debugging
  # Add any other subspecs you want to use in your project
  ]
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
futurechallenger commented 6 years ago

Here's how I resolved my problem. I'm using RN 0.54.0. I checked the pod file with this path ../node_modules/react-native/third-party-podspecs/GLog.podspec. There is a glog file but it is like this ../node_modules/react-native/third-party-podspecs/glog.podspec.

so change the podfile's glog pod to this:

pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'

If your file is just named Glog.podspec, just ignore my answer.

ValeriyKliuk commented 6 years ago

@futurechallenger lucky you ;) at the beginning I got glog doesn't match the expected one GLog:

Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `GLog` from `../node_modules/react-native/third-party-podspecs/GLog.podspec`
[!] The name of the given podspec `glog` doesn't match the expected one `GLog`****

... and after changing the podfile's GLog to glog this one: Unable to find a specification for boost-for-react-native depended upon by Folly.

Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] Unable to find a specification for `boost-for-react-native` depended upon by `Folly`**
ValeriyKliuk commented 6 years ago

removed cocoapods https://superuser.com/questions/686317/how-to-fully-uninstall-the-cocoapods-from-the-mac-machine

double check for brew brew uninstall cocoapods

reinstall cocoapods brew install ruby sudo gem install cocoapods

add pod 'boost-for-react-native' to Podfile pod update

Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Installing DoubleConversion (1.1.5)
Installing Folly (2016.09.26.00)
Installing React (0.55.1)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.4)
Installing yoga (0.55.1.React)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 11 dependencies from the Podfile and 6 total pods installed.
matteocollina commented 6 years ago

@futurechallenger can you explain your Podfile? or the section of React ?

jeremyclee commented 6 years ago

I had recently updated to cocoa pods 1.5.0 when I started to get this error.

After trying a bunch of things here, I realized that I just needed to run 'pod repo update' again, and it was all resolved for me. RN 54.4