facebook / react-native

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

folly/folly-config.h file not found #32985

Closed hellforever closed 2 years ago

hellforever commented 2 years ago

Description

I am bumping react native version from 0.63.3 to 0.67.1 for my project. After updating all necessary libraries. I tried to build the project on Xcode, but every time I got this issue: folly/folly-config.h file not found. I tried to clear Xcode cache and delete pods directories, but it is the same.

Version

0.67.1

Output of npx react-native info

System: OS: macOS 11.5.2 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 562.37 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.18.3 - ~/.nvm/versions/node/v14.18.3/bin/node Yarn: Not Found npm: 6.14.15 - ~/.nvm/versions/node/v14.18.3/bin/npm Watchman: 2022.01.17.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /Users/fepc-412/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: API Levels: 29, 30, 31 Build Tools: 28.0.3, 29.0.1, 29.0.2, 30.0.1, 30.0.2, 30.0.3, 31.0.0 System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8092744 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 1.8.0_291 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.1 => 0.67.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  1. rm -rf node_modules/
  2. npm install
  3. cd ios and run pod install
  4. click build on Xcode

Podfile: ``require_relative '../node_modules/react-native/scripts/react_native_pods' platform :ios, '11.0'

project 'XX', 'DevDebug' => :debug, 'QADebug' => :debug, 'ProdDebug' => :debug, 'DevRelease' => :release, 'QARelease' => :release, 'ProdRelease' => :release

require_relative "../node_modules/@react-native-community/cli-platform-ios/native_modules"

pre_install do |installer| $RNMBGL.pre_install(installer) end

target 'XXX' do pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/React/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-logger', :path => '../node_modules/react-native/ReactCommon/logger' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info' pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 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 'react-native-pager-view', :path => '../node_modules/react-native-pager-view'

pod 'RNSVG', :path => '../node_modules/react-native-svg'

pod 'GoogleUtilities', '6.7.2'

pod 'RNPermissions', :path => '../node_modules/react-native-permissions' permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy" pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"

pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

pod 'react-native-geolocation', :path => '../node_modules/@react-native-community/geolocation'

pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'

pod 'ReactNativeART', :path => '../node_modules/@react-native-community/art' pod 'react-native-progress-view', :path => '../node_modules/@react-native-community/progress-view'

pod 'RNI18n', :path => '../node_modules/react-native-i18n' pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker' pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker' pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

pod 'react-native-mapbox-gl', :path => '../node_modules/@react-native-mapbox-gl/maps' $ReactNativeMapboxGLIOSVersion = '6.2.1'

pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec' pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec' pod 'React-perflogger', :path => '../node_modules/react-native/ReactCommon/reactperflogger' pod 'React-runtimeexecutor', :path => '../node_modules/react-native/ReactCommon/runtimeexecutor'

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

pod 'SSZipArchive', '2.2.2' pod 'RNNativeFetchModule', :path => '../node_modules/native-fetch'

pod 'react-native-ble-plx', :path => '../node_modules/react-native-ble-plx' pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler' pod 'RNZipArchive', :path => '../node_modules/react-native-zip-archive' pod 'react-native-pdf', :path => '../node_modules/react-native-pdf'

pod 'react-native-view-shot', :path => '../node_modules/react-native-view-shot'

pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'

pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'

pod 'RNFBIid', :path => '../node_modules/@react-native-firebase/iid'

pod 'RNFBPerf', :path => '../node_modules/@react-native-firebase/perf'

pod 'RNFBCrashlytics', :path => '../node_modules/@react-native-firebase/crashlytics'

pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics' pod 'react-native-config', :path => '../node_modules/react-native-config'

end

post_install do |installer| installer.pods_project.targets.each do |target| targets_to_ignore = %w(React yoga) if targets_to_ignore.include? target.name target.remove_from_project end end installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" end $RNMBGL.post_install(installer) end ``

Error message:

/xxx/ios/Pods/Headers/Public/RCT-Folly/folly/portability/Config.h:20:10: 'folly/folly-config.h' file not found

/xxx/node_modules/realm/react-native/ios/RealmReact/RealmAnalytics.mm:57:9: in file included from /xxx/node_modules/realm/react-native/ios/RealmReact/RealmAnalytics.mm:57:

/xxx/node_modules/realm/react-native/ios/RealmReact/RealmAnalytics.h:57:9: in file included from /xxx/node_modules/realm/react-native/ios/RealmReact/RealmAnalytics.h:57:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:10: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include/assert.h:44:10: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include/assert.h:44:

/xxx/ios/Pods/Headers/Public/RCT-Folly/folly/portability/stdlib.h:21:10: in file included from /xxx/ios/Pods/Headers/Public/RCT-Folly/folly/portability/stdlib.h:21:

cortinico commented 2 years ago

I am bumping react native version from 0.63.3 to 0.67.1 for my project. After updating all necessary libraries. I tried to build the project on Xcode, but every time I got this issue: folly/folly-config.h file not found. I tried to clear Xcode cache and delete pods directories, but it is the same.

cc @dmitryrykun @hramos as they know more than me.

Essentially folly/folly-config.h file not found happens as you're not passing the -DFOLLY_NO_CONFIG flag to the compiler.

I'm unsure if this is supposed to be configured automatically from Cocoapods or not. However 0.63 to 0.67 is quite a long jump. You should maybe do version by version update.

dmytrorykun commented 2 years ago

That's true, you have to add -DFOLLY_NO_CONFIG flag to the Other C++ Flags section in your target's Build Settings. We're updating the Playbook to include this step.

hellforever commented 2 years ago

It turned out to be a realm setting issue: https://github.com/realm/realm-js/issues/4285

silviaskura commented 2 years ago

That's true, you have to add -DFOLLY_NO_CONFIG flag to the Other C++ Flags section in your target's Build Settings. We're updating the Playbook to include this step.

@dmitryrykun Could you show how you do this? I have already -DFOLLY_NO_CONFIG in my Other C Flags. I have added this to Other C++ Flags too but nothing happened

vuongtuananh commented 2 years ago

I am facing the same issue :( @silviaskura: Have you fixed it?

azizmobarak commented 2 years ago

same issue here with RN 0.69.4, @vuongtuananh did you fix it?

vuongtuananh commented 2 years ago

same issue here with RN 0.69.4, @vuongtuananh did you fix it? @azizmobarak For me, I found out that I was wrong --configuration. After correction, the issue disappeared. (Because I customed debug --> devDebug. So I need to run command: npx react-native run-ios --configuration devDebug)

azizmobarak commented 2 years ago

@vuongtuananh thanks, I have fixed it by adding some configurations in Xcode , I dismiss to check the updated doc for >0.69 , the soloution is on the bottom of the page here react native doc

SONGDAM commented 1 year ago

That's true, you have to add -DFOLLY_NO_CONFIG flag to the Other C++ Flags section in your target's Build Settings. We're updating the Playbook to include this step.

How to add flag.... I can't understand flag means can you reply comments? @silviaskura