After reading https://reactnative.dev/docs/environment-setup, I created a react-native project using npx react-native init ***.
It was successful, so, I tried to run the project using npx react-native run-ios, and got the below error:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/loser/Library/Developer/Xcode/DerivedData/test0205-dasunahpjpavelgmslwgmvjhesxy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/loser/Documents/projects/test0205/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
The only fix worked for me
There is no need to disable flipper or juggle with its versions
add this to your Podfile in post_install section
system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework')
it will look like this
...
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
# check if file system is case sensitive
# if so then create symbolic links
# for every openssl framework with name in lowercase
unless File.exist? "pods"
system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework')
end
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
...
then
remove Pods folder and Podfile.lock
run pod install
build your app (npx react-native run-ios in the root folder of your app)
Explanation
In my case the issue was the case sensitive file system. You can search in terminal for fatal error: 'openssl/opensslv.h' file not found or just try to build using this fix.
you can easily comment out these lines to disable flipper :
# add_flipper_pods!
# post_install do |installer|
# flipper_post_install(installer)
# end
and comment out this lines in appDelegate.m :
//#if DEBUG
//#import <FlipperKit/FlipperClient.h>
//#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
//#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
//#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
//#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
//#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
//static void InitializeFlipper(UIApplication *application) {
// FlipperClient *client = [FlipperClient sharedClient];
// SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
// [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
// [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
// [client addPlugin:[FlipperKitReactPlugin new]];
// [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
// [client start];
//}
//#endif
also this in the same file:
// #if DEBUG
// InitializeFlipper(application);
// #endif
This issue is caused by flipper-folly pod spec updates
Remove/uninstall react-native-cli, just use npx
Try this on react-native 0.63.4 (previous stable version).
Remember it doesn't work for latest 0.64.0 with XCode 12.5
Inside ios/Podfile replace use_flipper! with:
use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0','Flipper-RSocket' => '1.3.1' })
pod install --repo-update
npx react-native run-ios
if you don't need to use flipper or still getting some issues try commenting out flipper inside podfile and install pods using command
pod install --repo-update
#use_flipper!()
#post_install do |installer|
#flipper_post_install(installer)
#end
This is caused by Flipper-Folly being broken on the latest Catalina build.
Until this gets patched, your best bet is to force your cocoapods to the latest working version (2.3.0).
Go to your project folder root and open the /ios directory.
cd ios
Open your Podfile and change the following block of code:
use_flipper!
to
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
Inside the /ios directory run the following command:
pod install
If it worked, go back to your project root and try to run the project
cd ..
npx react-native run-ios
in case it didn't, check the Compatibility trouble-shooting section:
After trying to run pod install you may have gotten a similar error to this:
[!] CocoaPods could not find compatible versions for pod "Flipper-Folly":
In Podfile:
Flipper-Folly (= 2.3.0)
Flipper-RSocket (~> 1.1) was resolved to 1.3.0, which depends on
Flipper-Folly (~> 2.5)
FlipperKit/FBCxxFollyDynamicConvert (~> 0.54.0) was resolved to 0.54.0,
which depends on
Flipper-Folly (~> 2.2)
In order to solve this
Go back to your /ios folder
cd ios
And remove the Podfile.lock file
rm -rf Podfile.lock
Install the pods again
pod install
And run react-native
cd ..
npx react-native run-ios
use_flipper! to use_flipper!({ 'Flipper-Folly' => '2.3.0' })pod installFrom mmemories, it's necessary to execute pod install command before !
This seems to be an issue in react-native 0.63, try initiating the project with --version 0.62 and it should work until they fix the bug
It's because of use_flipper in Podfile for iOS project.
use_flipper!
So, I was needed to indicate Flipper-Folly version with use_flipper as
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
It worked perfectly after that change.
React version -0. 63 I am still facing the same issue while starting a new project for iOS in Mac. I have followed these steps given below but still the issue
npx react-native init xxxx
cd xxxx
npx react-native run-ios
pod install
After doin this I got the following error
** BUILD FAILED **
The following build commands failed:
CompileC /Users/apple/Library/Developer/Xcode/DerivedData/profirst-bbfobfkgbfqalecezvbonnkwcffv/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/apple/profirst/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Later I have changed in the pod file
use_flipper! to use_flipper!({ 'Flipper-Folly' => '2.3.0' }), but I'm still having the same issue.
Here is a screenshot of the problem
Following Everest Climber answer
Change use_flipper! to use_flipper!({ 'Flipper-Folly' => '2.3.0' })
This worked for me. Hopefully, it works for you too
If nothing works, comment it.
# use_flipper!({ 'Flipper-Folly' => '2.5.1' })
I tried everything here and a lot more and nothing worked!
I then:
--legacy-peer-deps for me),npx pod-install (or cd ios/, pod-install)npx react-native run-iosAnd it finally worked.
Apparently deleting the node_modules did the trick, but do not ask me why.
I could solve this issue after disabling Flipper in ios/Podfile.
For me disabling flipper from Podfile works!!
updated Podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'ReactNativeApp' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'ReactNativeAppTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!({ 'Flipper-Folly' => '2.3.0' })
# post_install do |installer|
# flipper_post_install(installer)
# end
end
target 'ReactNativeApp-tvOS' do
# Pods for ReactNativeApp-tvOS
target 'ReactNativeApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
cd ios && pod installcd .. && npx react-native run-iosYes, Everest Climber is right. It's broken after I updated my react-native-CLI. It's because of the use_flipper new version.
Steps to fix it:
> Open Podfile for the iOS project.
> Replace `use_flipper!` with `use_flipper!({ 'Flipper-Folly' => '2.3.0' })`.
> Then you must remove both Pods directory and Podfile.lock.
> open terminal and go to iOS project directory.
> Do `pod install`.
It's worked for me perfectly.