39

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)
michael
  • 4,053
  • 2
  • 12
  • 31
Everest Climber
  • 1,203
  • 1
  • 9
  • 15
  • I am experiencing exactly the same problem right now, brand new app and cannot build. I tried running the app both using `npx react-native run-ios` and `yarn ios` but no difference. – th3n3rd Feb 06 '21 at 09:54
  • 2
    Seems to be an issue with the latest MacOs and xCode trying to compile Flipper. Here's a potential fix: https://github.com/facebook/react-native/issues/30836#issuecomment-772830882 – Marcel Kalveram Feb 07 '21 at 13:20

16 Answers16

46

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.

Everest Climber
  • 1,203
  • 1
  • 9
  • 15
24

Following Everest Climber answer

  1. In Podfile under ios/ folder

    Change use_flipper! to use_flipper!({ 'Flipper-Folly' => '2.3.0' })

  2. cd ios
  3. pod install
  4. pod update
  5. cd .. && npx react-native run-ios (to run the application)

This worked for me. Hopefully, it works for you too

Suulola
  • 241
  • 1
  • 3
  • This only worked for me after renaming `Podfile.lock` to `Podfile.lock.temp` (or any other different name) – Steve Feb 28 '21 at 15:36
18

I could solve this issue after disabling Flipper in ios/Podfile.

  1. Fix Podfile as shown in below image

enter image description here

  1. cd ios
  2. delete Pods folder and Podfile.lock
  3. pod install
  4. pod update
  5. cd .. && npx react-native run-ios
Prime
  • 2,809
  • 1
  • 7
  • 23
6

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
Ashwin J
  • 662
  • 7
  • 12
5

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

bob3825
  • 51
  • 1
  • 1
    It has helped me, thanks. The commands I used: `rm -rf MyApp` to remove the project directory and `npx react-native init MyApp --version 0.62` to create a blank project again with the proper version. – Finesse Feb 08 '21 at 07:10
4

Yes, 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.

Ramesh Boosa
  • 198
  • 8
2

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

2
  1. Replace in ios/Podfile – use_flipper! to use_flipper!({ 'Flipper-Folly' => '2.3.0' })
  2. Exclude ios/Podfile.lock
  3. pod install
Henrique
  • 101
  • 1
  • 2
2

If nothing works, comment it.

# use_flipper!({ 'Flipper-Folly' => '2.5.1' })
uchiha
  • 81
  • 6
1

From mmemories, it's necessary to execute pod install command before !

HyperNovax
  • 116
  • 2
  • 12
1

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.

Vitaliy D
  • 29
  • 5
0

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 install
  • cd .. && npx react-native run-ios
Vikas Sharma
  • 685
  • 8
  • 18
  • Disabling of flipper needs to add the use_frameworks or not needed to add use_frameworks – sejn Mar 11 '21 at 04:14
0

I tried everything here and a lot more and nothing worked!

I then:

  • deleted my node_modules (the only thing I hadn't done yet),
  • deleted Pods folder and Podfile.lock,
  • then npm install (with --legacy-peer-deps for me),
  • npx pod-install (or cd ios/, pod-install)
  • npx react-native run-ios

And it finally worked.

Apparently deleting the node_modules did the trick, but do not ask me why.

race_carr
  • 1,387
  • 12
  • 21
XplosiVe06
  • 568
  • 3
  • 23
0

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
0
use_flipper!({ 'Flipper' => '0.145.0' })

use this in pod file. worked for me...

delete the podfile.lock then run,

pod install
pod update
General Grievance
  • 4,555
  • 31
  • 31
  • 45
-2

How to fix:

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).

  1. Go to your project folder root and open the /ios directory.

    cd ios
    
  2. Open your Podfile and change the following block of code:

    use_flipper!
    

    to

    use_flipper!({ 'Flipper-Folly' => '2.3.0' })
    
  3. Inside the /ios directory run the following command:

    pod install
    
  4. 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:

Compatibility trouble-shooting

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

  1. Go back to your /ios folder

    cd ios
    
  2. And remove the Podfile.lock file

    rm -rf Podfile.lock
    
  3. Install the pods again

    pod install
    
  4. And run react-native

    cd ..
    npx react-native run-ios
    
Samuel Hulla
  • 6,617
  • 7
  • 36
  • 70