flipper
flipper copied to clipboard
No member named 'folly' in namespace 'folly'
🐛 Bug Report
Cannot build react native project
Error Message :
/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1043:5 No member named 'folly' in namespace 'folly'; did you mean simply 'folly'?
To Reproduce
rm -rf Pods & rm Podfile.lock
arch -x86_64 pod install --repo-update
Environment
package.json
{
"name": "HarmoniRn",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"postinstall": "patch-package",
"renew-pods-m1": "cd ios; rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf [PROJECT_NAME].xcworkspace; rm -rf ~/Library/Developer/Xcode/DerivedData; pod deintegrate; pod setup; arch -x86_64 pod install --repo-update;"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.10",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-firebase/app": "^15.7.0",
"@react-native-firebase/messaging": "^15.7.0",
"@react-navigation/native": "^6.0.13",
"@react-navigation/native-stack": "^6.9.0",
"@types/react-native-vector-icons": "^6.4.12",
"axios": "^0.27.2",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"react": "18.1.0",
"react-native": "0.70.0",
"react-native-contacts": "^7.0.5",
"react-native-fingerprint-scanner": "^6.0.0",
"react-native-google-mobile-ads": "^8.1.0",
"react-native-permissions": "^3.6.1",
"react-native-progress": "^5.0.0",
"react-native-prompt-android": "^1.1.0",
"react-native-push-notification": "^8.1.1",
"react-native-safe-area-context": "^4.3.3",
"react-native-screens": "^3.17.0",
"react-native-sha256": "^1.4.8",
"react-native-svg": "^13.2.0",
"react-native-url-polyfill": "^1.3.0",
"react-native-vector-icons": "^9.2.0",
"react-native-webview": "^11.23.1",
"recoil": "^0.7.5"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.70.0",
"@types/react-native-push-notification": "^8.1.1",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.72.1",
"react-test-renderer": "18.1.0",
"typescript": "^4.8.3"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
}
Podfile ( I tried many things.. )
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '14.0'
install! 'cocoapods', :deterministic_uuids => false
use_modular_headers!
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
target 'HarmoniRn' do
config = use_native_modules!
# Flags change depending on the env values.
flags = get_default_flags()
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => true,
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => FlipperConfiguration.enabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
# use_flipper!({
# 'Flipper' => '0.75.1',
# 'Flipper-DoubleConversion' => '1.1.7',
# 'Flipper-Folly' => '2.5.3',
# 'Flipper-Glog' => '0.3.6',
# 'Flipper-PeerTalk' => '0.0.4',
# 'Flipper-RSocket' => '1.3.1',
# 'FlipperKit' => '0.75.1',
# 'FlipperKit/Core' => '0.75.1',
# 'FlipperKit/CppBridge' => '0.75.1',
# 'FlipperKit/FBCxxFollyDynamicConvert' => '0.75.1',
# 'FlipperKit/FBDefines' => '0.75.1',
# 'FlipperKit/FKPortForwarding' => '0.75.1',
# 'FlipperKit/FlipperKitHighlightOverlay' => '0.75.1',
# 'FlipperKit/FlipperKitLayoutPlugin' => '0.75.1',
# 'FlipperKit/FlipperKitLayoutTextSearchable' => '0.75.1',
# 'FlipperKit/FlipperKitNetworkPlugin' => '0.75.1',
# 'FlipperKit/FlipperKitReactPlugin' => '0.75.1',
# 'FlipperKit/FlipperKitUserDefaultsPlugin' => '0.75.1',
# 'FlipperKit/SKIOSNetworkPlugin' => '0.75.1',
# 'OpenSSL-Universal' => '1.1.180'
# })
target 'HarmoniRnTests' do
inherit! :complete
# Pods for testing
end
# post_install do |installer|
# react_native_post_install(
# installer,
# # Set `mac_catalyst_enabled` to `true` in order to apply patches
# # necessary for Mac Catalyst builds
# :mac_catalyst_enabled => false
# )
# __apply_Xcode_12_5_M1_post_install_workaround(installer)
# end
post_install do |installer|
flipper_post_install(installer)
## Fix for XCode 12.5 & RN 0.62.2 - See https://github.com/facebook/react-native/issues/28405
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
"RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
## Fix for Flipper-Folly on iOS 14.5
find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
"atomic_notify_one(state)", "folly::atomic_notify_one(state)")
find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
"atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")
end
end
I had same issue:
you may need to remove these lines(replace
) which causes inconsistency.. to newer Flipper ver.
## Fix for Flipper-Folly on iOS 14.5
find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
"atomic_notify_one(state)", "folly::atomic_notify_one(state)")
find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
"atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")
end