Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode throws 'atomic_notify_one<unsigned long>' is unavailable

I installed Xcode 12 on my Mac, tried building my react native app that runs perfectly on android, and get 'atomic_notify_one<unsigned long>' is unavailable. This is the most information I get from the error.

like image 355
Marvelous Ikechi Avatar asked Feb 13 '21 20:02

Marvelous Ikechi


5 Answers

Instead of commenting out flipper here is a solution that worked for me.

Update flipper in your Podfile to look like this

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

Run pod repo update inside the ios folder

And finally, update your project pods using

pod install

like image 190
kabangi julius Avatar answered Oct 20 '22 23:10

kabangi julius


This issue happened again today after the iOS simulators were updated to iOS 14.5. The answer posted by "Shared S Katre" seems to be a good work-around.

Because React-Native is open source code, I would think that any big updates on iOS can definitely bring about breaking changes. I imagine those will be fixed later.

Anyways - the issue does seem to be with Flipper, which serves as a debugging tool for RN (https://reactnative.dev/blog/2020/03/26/version-0.62).

If you just need to get your project to build, you can just simply comment out flipper in your podfile, and re-install your pods like so.

Podfile

# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()

Next, re-install your pods. I cd'd into the root of the project and used npx.

$ npx pod-install

Last, try building and running your project:

$ npx react-native run-ios

Update:

Per the comments, looks like this has been fixed now. If you want flipper, you should be able to revert your Podfile and update flipper.

See: https://stackoverflow.com/a/67314652/9906042

Thanks Stackers!

like image 41
cy-c Avatar answered Oct 20 '22 22:10

cy-c


  1. Fix Podfile as shown in below image enter image description here
  2. cd ios
  3. delete Pods folder and Podfile.lock
  4. pod install
  5. pod update
  6. cd .. && npx react-native run-ios
like image 22
shicheng王事成 Avatar answered Oct 20 '22 22:10

shicheng王事成


If someone has still this error (I have just updated Mac, Xcode, etc), you can fix the build without disabling Flipper and Hermes; in your Pod file under post_install just add (I have found it somewhere on the web and changed it to fix new errors with the last updates):

post_install do |installer|
    flipper_post_install(installer)
    react_native_post_install(installer)

    # # to build for the simulator on Apple M1
    # installer.pods_project.targets.each do |target|
    #   target.build_configurations.each do |config|
    #     # disables arm64 builds for the simulator
    #     config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
    #   end
    # end

    ## 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/Headers/Private/RCT-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

Before your target, add

# fixes for last Mac updates
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
like image 17
opensw Avatar answered Oct 21 '22 00:10

opensw


I have to comment all #ifdef FB_SONARKIT_ENABLED in AppDelegate.m, set hermes to false and comment Flipper in Podfile.

After all, delete Pods and Podfile.lock, then pod install

like image 13
Alan Oliveira de Quadros Avatar answered Oct 20 '22 23:10

Alan Oliveira de Quadros