React Native Build Error on IOS - typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')

Viewed 29367

After upgrading React Native from 0.61.5 to 0.63.2, Flipper causes an error on IOS as typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')

On github there are a few proposed answers but none of them solved my problem https://github.com/facebook/flipper/issues/834

Is there anyone figured out how to solve this?

Many thanks

9 Answers

Note that if you have use_frameworks! enabled, Flipper will not work and you should disable these next few lines in your Podfile.

  # use_flipper!
  # post_install do |installer|
  #   flipper_post_install(installer)
  # end

STEP 1:

Go to YOUR_PROJECT > ios > Podfile and then comment these lines

  # use_flipper!()

  # post_install do |installer|
  #   react_native_post_install(installer)
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  # end

STEP 2:

after step 1 you have to run pod update command on YOUR_PROJECT > ios path.

Bingo its done.


IMPORTANT

In case you get some errors after doing above 2 steps,

  1. GO to YOUR_PROJECT > ios > YOUR_PROJECT_NAME > and run this command
  2. plutil ./Info.plist it will show you where the issue is.
  3. Then fix that issue from your text editor.

Update your pod file with below code.

use_flipper!({ 'Flipper-Folly' => '2.3.0' }) # update this part
 post_install do |installer|
   flipper_post_install(installer)
 end

I needed to specify the versions:

  # https://github.com/facebook/flipper/releases
  # https://cocoapods.org/pods/Flipper-Folly
  # https://cocoapods.org/pods/OpenSSL-Universal
  use_flipper!({
    "Flipper" => "0.134.0",
    "Flipper-Folly" => "2.6.10",
    "OpenSSL-Universal" => "1.1.1100"
  })

And for a full Podfile, it might help:

require_relative "../node_modules/expo/scripts/autolinking"
require_relative "../node_modules/react-native/scripts/react_native_pods"
require_relative "../node_modules/@react-native-community/cli-platform-ios/native_modules"

platform :ios, "12.0"

target "socializus" do
  use_expo_modules!

  config = use_native_modules!

  use_react_native!(
    path: config[:reactNativePath],
    hermes_enabled: false
  )

  # https://github.com/facebook/flipper/releases
  # https://cocoapods.org/pods/Flipper-Folly
  # https://cocoapods.org/pods/OpenSSL-Universal
  use_flipper!({
    "Flipper" => "0.134.0",
    "Flipper-Folly" => "2.6.10",
    "OpenSSL-Universal" => "1.1.1100"
  })

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

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete "IPHONEOS_DEPLOYMENT_TARGET"
      end
    end
  end
end

if you do not want to remove Flipper from your app then go through this solution.

your pod.file like this

add_flipper_pods!('Flipper' => '0.74.0')

upgrade Flipper-Folly by doing this

remove this line add_flipper_pods!('Flipper' => '0.74.0')

add this line add_flipper_pods!('Flipper-Folly' => '2.3.0')

In my case, my XCode version was 11.5 and it was not supporting something newer in Flipper. Updating my XCode to version 12 fixed it immediately.

I upgraded from react-native 0.65 to 0.68.
Deleted Pods and Podfile.lock and then ran pod update from within my iOS directory.
Didn't have to change any other code.

Thanks to @Sultan Aslam for mentioning pod update

Directories name should not have space in which project exists. This can also cause this error.

This is what solves for me for react native 0.65. It is very important that folly should link to 9.0

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.delete "IPHONEOS_DEPLOYMENT_TARGET"
  end
  case target.name
  when 'RCT-Folly'
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
 end
end
Related