flipper: Flipper doesn't build with Xcode 12.5 RC

šŸ› Bug Report

Flipper in a React Native project fails to build with the following error:

~/MyProject/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1051:5: 'atomic_notify_one<unsigned long>' is unavailable
Build log
[... TRUNCATED ...][]

In file included from ~/MyProject/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp:17:
In file included from ~/MyProject/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex.h:344:
~/MyProject/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1051:5: error: 'atomic_notify_one<unsigned long>' is unavailable
    atomic_notify_one(state);
    ^
~/MyProject/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1573:5: note: in instantiation of function template specialization 'folly::detail::distributed_mutex::wakeTimedWaiters<std::__1::atomic<unsigned long>>' requested here
    wakeTimedWaiters(&state_, proxy.timedWaiters_);
    ^
In file included from ~/MyProject/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp:17:
In file included from ~/MyProject/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex.h:19:
In file included from ~/MyProject/ios/Pods/Headers/Private/Flipper-Folly/folly/Optional.h:58:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/c++/v1/functional:504:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/c++/v1/memory:681:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/c++/v1/atomic:2140:6: note: 'atomic_notify_one<unsigned long>' has been explicitly marked unavailable here
void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT
     ^
1 error generated.

[... TRUNCATED ...]

Build failed    21.4.2021, 11.51    34.5 seconds

Cleaning the Xcode build folder didn’t help, nor does updating Flipper and Flipper-Folly to the latest versions.

To Reproduce

  1. Install Xcode 12.5 RC from Apple
  2. Open a React Native project with Flipper enabled
  3. Try to build that project
  4. The build fails

Environment

  • Xcode 12.5 RC
  • React Native 0.63.4
  • Pods:
    • Flipper (0.85.0)
    • Flipper-DoubleConversion (1.1.7)
    • Flipper-Folly (2.5.1)
    • Flipper-Glog (0.3.6)
    • Flipper-PeerTalk (0.0.4)
    • Flipper-RSocket (1.3.1)
    • FlipperKit (0.85.0)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 60
  • Comments: 78 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I will take a look at this by today or tomorrow and will release a new Flipper-Folly version.

Now, i just need update this file and it run normally. Hope it will be resolve in the next version. This file in: {project-name}/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h

Screen Shot 2021-04-27 at 15 25 12

https://github.com/facebook/folly/commit/8477e25603f131c0400b6964609c76b438826788#diff-65ad309ca9c636ba81eb7953fce06e6963c51296a60dc25eb4a5b1463482c6da

This worked for me. On react native 0.63.4 use_flipper!({ ā€˜Flipper-Folly’ => ā€˜2.5.3’, ā€˜Flipper’ => ā€˜0.87.0’, ā€˜Flipper-RSocket’ => ā€˜1.3.1’ })

As a hotfix I have patched 2.5.1 with the above mentioned patch in Flipper-Folly 2.5.3

I will follow up with RN folks regarding consolidating Flipper-Folly and RCT-Folly into one and have a consistent workflow of maintaining it.

But for now Flipper-Folly 2.5.3 should unblock.

Sucks.

I have solved the above error. Now fixing the other errors.

Installation of version 2.5.2 works for me, but now I get this error:

/Users/<...>/Pods/Headers/Public/Flipper-Folly/folly/portability/Time.h:52:17: Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')

I’m getting the same error in our React Native app. Here’s some related issues I was able to dig up:

https://github.com/facebook/folly/issues/1527

https://github.com/facebook/react-native/issues/31179

Looks like the underlying issue was resolved (here: https://github.com/facebook/folly/commit/8477e25603f131c0400b6964609c76b438826788), but it hasn’t been published to cocoapods yet.

This worked for me. On react native 0.63.4 use_flipper!({ ā€˜Flipper-Folly’ => ā€˜2.5.3’, ā€˜Flipper’ => ā€˜0.87.0’, ā€˜Flipper-RSocket’ => ā€˜1.3.1’ })

This works perfectly! Just do pod install --repo-update and everything will be fine! Thank you!

@priteshrnandgaonkar deleted the podfile-lock and folder, those commands still led me to install 2.5.1

Managed to use the temporary code fix above posted by j2teamlbh, what made it finally work was ensuring that in the podfile you specify that you’re using use_flipper!({ 'Flipper-Folly' => '2.3.0' })

As a hotfix I have patched 2.5.1 with the above mentioned patch in Flipper-Folly 2.5.3

I will follow up with RN folks regarding consolidating Flipper-Folly and RCT-Folly into one and have a consistent workflow of maintaining it.

But for now Flipper-Folly 2.5.3 should unblock.

THANKS

It would be nice if you could get with them and get them to commit to removing Flipper from CRNA and expo init. This package is below 1.0, is woefully slow and plagued by instability and performance variance between different versions and frequently has breaking changes. It doesn’t belong in starter templates and it shouldn’t be a requirement for getting started with React Native. The amount of downtime, CI slowness, failed and slowed builds it has caused could probably be valued in the hundreds of thousands of $$$, all because someone made the decision to make the RN community guinea pigs for this tool. Reactotron is infinitely better despite being created by a third party, not updated for 2 years and swizzling APIs that Facebook didn’t open to it. I have a 2020 MBP and Flipper performs terribly on it. What audience is this tool really intended for if it can’t perform on a new MBP, breaks frequently, and slows down people’s builds? Now lets say it finally performs like its contemporaries, tools like VSCode or whatever else. Then I’d understand, and I’d probably even use it. But why is it in production now in the state that it is?

@priteshrnandgaonkar on my side it says

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/time.h:172:3: note: previous definition is here
} clockid_t;

It’s working for me now! (I initially got the 2.5.2 not found error – cocoapods probably just needed a minute to propagate the update, or something)

tried but still same error

[!] CocoaPods could not find compatible versions for pod "Flipper-Folly":
  In Podfile:
    Flipper-Folly (= 2.5.2)

None of your spec sources contain a spec satisfying the dependency: `Flipper-Folly (= 2.5.2)`.

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

How are we to update Flipper-Folly?

This disables Flipper, but it’s a quick workaround if you (like me) need the project working again.

  1. Podfile, comment Flipper:
#   use_flipper!()
#   post_install do |installer|
#     react_native_post_install(installer)
#   end
  1. cd ios and delete the ā€˜Pods folder’ folder and ā€˜Podfile.lock’
  2. pod install

However this ain’t working, tried numerous times there’s still a build error. 😦

Guys please stop asking, read the comments, they already fixed it and they give the solution

Hey guys they push a new version.

You just need to edit your code to that

  use_flipper!({ 'Flipper' => '0.87.0' })
  post_install do |installer|
    flipper_post_install(installer)
  end

And run npx pod-install

same issue but why even I still disabled flipper on ios and I’m still getting a build error?

Me too - I get the following:

CompileC /Users/alex.hooper/Library/Developer/Xcode/DerivedData/Espresso-brgntaoyjolqyfdzcsunjlqtzzum/Build/Intermediates.noindex/Espresso.build/Debug-iphoneos/Espresso.build/Objects-normal/arm64/AppDelegate.o /Users/alex.hooper/Documents/figloo-bank-mobile/ios/Espresso/AppDelegate.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

xCode 12.5 has released yesterday, this error still here. I hope we will be resolve the error for the next version

Same as you. I feel no hope right now. after tried every each solution, issue is still fucking there.

Still getting the same error after updating and reinstalling pods ? any workaround you guys did ? my flipper config is already commented in podfile

āŒ  /Users/shivam/Documents/ReactNative/SQL-Playground/ios/Pods/Headers/Private/RCT-Folly/folly/synchronization/DistributedMutex-inl.h:1051:5: 'atomic_notify_one<unsigned long>' is unavailable

    atomic_notify_one(state);
    ^

Yes because they have updated Flipper-folly not RCT-folly, You will need to add these lines to your podfile

use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })


  # Define find-and-replace function
  def find_and_replace(dir, findstr, replacestr)
    Dir[dir].each do |name|
        text = File.read(name)
        replace = text.gsub(findstr,replacestr)
        replaced = text.index(replacestr)
        if replaced == nil && 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

  post_install do |installer|
    react_native_post_install(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
        end
    end
    
#     Fix for Flipper-Folly on iOS 14.5
#    These are no longer required as Flipper-folly is updated
#   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)")

  find_and_replace("Pods/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
                   "atomic_notify_one(state)", "folly::atomic_notify_one(state)")

  find_and_replace("Pods/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
  "atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")

    
  end

@kkelley-leftbrain I got past OpenSSL issues by adding the version of OpenSSL-Universal in the Podfile:

target 'MyApp' do
  ...
  pod 'OpenSSL-Universal', '~>1.1.180' 
  ...  
  use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
  post_install do |installer|
    flipper_post_install(installer)
  end
end

In my case it was previously pinned to an older version.

Same, works here. Thx!

I’m the only person on my team still advocating for flipper as a debug tool, but man… this crap just completely blocks my team.

same issue but why even I still disabled flipper on ios and I’m still getting a build error?

Yeah, even if we enter that condition we set FOLLY_HAVE_CLOCK_GETTIME = 1, which should avoid typedef uint8_t clockid_t

Yea, but I just tested and we don’t seem to be entering that condition. So FOLLY_HAVE_CLOCK_GETTIME ends up not being defined (it’s not a default flag for the Flipper-Folly target either). It’s most likely because the new SDK version defines them again. We would probably need a new rule around this.

I tried setting them outside the target os condition to see what would happen and it seems to keep going but I hit another error down the line. This will be a bit trickier than expected I believe.

I would suggest sticking with 2.5.1 and applying this patch for now: https://github.com/facebook/flipper/issues/2215#issuecomment-827422023

I am curious how this error can happen, because Flipper-Folly has explicitly set FOLLY_HAVE_CLOCK_GETTIME=1 so that it won’t enter that if condition and it will use the one supplied from the sdk.

File ref: https://github.com/facebook/folly/blob/master/folly/portability/Time.h

In your app’s compiler flag build settings check if -DFOLLY_HAVE_CLOCK_GETTIME=0, if it is so then set -DFOLLY_HAVE_CLOCK_GETTIME=1

That flag would be overwritten by this https://github.com/facebook/folly/blob/master/folly/portability/Time.h#L35-L37 no?

It might be because the same files are also included by RCT-Folly. 😦

Maybe RN folks can help here.

It will be better if RN uses Flipper-Folly than RCT-Folly. It will solve this error.

Run pod repo update and then run pod install.

Managed to use the temporary code fix above posted by j2teamlbh, what made it finally work was ensuring that in the podfile you specify that you’re using use_flipper!({ 'Flipper-Folly' => '2.3.0' })

@AlexHooperDev you wouldn’t happen to know where I would put that change in my Podfile would you? I’m using using react native 62

platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'foobarbazapp' do
  # Pods for foobarbazapp
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/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-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 '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-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 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
  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 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'



  pod 'Firebase/Messaging', '~> 6.13.0'
  pod 'Firebase/Core', '~> 6.13.0'
  pod 'Firebase/DynamicLinks', '~> 6.13.0'


  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

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

  pod 'TrustKit', '~> 1.5.3'
  pod 'RNAzureNotificationHub', :podspec => '../node_modules/react-native-azurenotificationhub/RNAzureNotificationHub.podspec'


  target 'foobarbazappTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'foobarbazapp-tvOS' do
  # Pods for foobarbazapp-tvOS

  target 'foobarbazapp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

It’s up to you but I would put it below use_native_modules! end then run pod install

Managed to use the temporary code fix above posted by j2teamlbh, what made it finally work was ensuring that in the podfile you specify that you’re using use_flipper!({ 'Flipper-Folly' => '2.3.0' })

@AlexHooperDev you wouldn’t happen to know where I would put that change in my Podfile would you? I’m using using react native 62

platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'foobarbazapp' do
  # Pods for foobarbazapp
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/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-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 '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-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 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
  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 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'



  pod 'Firebase/Messaging', '~> 6.13.0'
  pod 'Firebase/Core', '~> 6.13.0'
  pod 'Firebase/DynamicLinks', '~> 6.13.0'


  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

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

  pod 'TrustKit', '~> 1.5.3'
  pod 'RNAzureNotificationHub', :podspec => '../node_modules/react-native-azurenotificationhub/RNAzureNotificationHub.podspec'


  target 'foobarbazappTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'foobarbazapp-tvOS' do
  # Pods for foobarbazapp-tvOS

  target 'foobarbazapp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Anyways, I was able to fix this by downgrading to XCode Version 12.4. It seems the issue for me happens when I updated my Xcode to the latest 12.5 version. until there’s a patch to fix this, i will continue using 12.4 version

Same issue by updating Xcode and my devices. Try many solutions but no one work.

I read facebook/folly@8477e25, the issue has resolved but flipper does not update yet