Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t') when building latest react-native rc with macOS target #834

Closed
mgcrea opened this issue Feb 26, 2020 · 105 comments
Assignees

Comments

@mgcrea
Copy link

mgcrea commented Feb 26, 2020

🐛 Bug Report

Looks like there is a blocking build issue in flipper that is preventing the new macOS target to work when building with the latest react-native release candidate (0.62.0.rc-3) that embeds flipper.

Exact error:

[...]/SandboxProject_62RC3/ios/Pods/Headers/Private/Flipper-Folly/folly/portability/Time.h:51:17: Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')

To Reproduce

  • Create a new react-native app using the latest release candidate
npx react-native init SandboxProject_62RC3 --version 0.62.0-rc.3
  • Open XCode
xed ios/
  • Enable macOS target (in Targets > General)

Screenshot 2020-02-26 at 19 00 47

Expected Behavior

Working build

@mweststrate
Copy link
Contributor

We fixed all known build issues last weeks, so bumping to rc.5 and bumping the Flipper version in your podfile to 0.33.1 should fix the issue. Would you mind verifying?

@mgcrea
Copy link
Author

mgcrea commented Mar 16, 2020

Unfortunately I'm still hitting the same issue, (using rc.5 and bumping Flipper version from 0.30.2 to 0.33.1).

[...]/SandboxProject_62RC5/ios/Pods/Headers/Private/Flipper-Folly/folly/portability/Time.h:51:17: Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')
▶ cat ios/Podfile.lock | grep -i flipper
  - Flipper (0.33.1):
    - Flipper-Folly (~> 2.1)
    - Flipper-RSocket (~> 1.0)
  - Flipper-DoubleConversion (1.1.7)
  - Flipper-Folly (2.1.1):
    - Flipper-DoubleConversion
    - Flipper-Glog
  - Flipper-Glog (0.3.6)
  - Flipper-PeerTalk (0.0.4)
  - Flipper-RSocket (1.0.0):
    - Flipper-Folly (~> 2.0)
  - FlipperKit (0.33.1):
    - FlipperKit/Core (= 0.33.1)
  - FlipperKit/Core (0.33.1):
    - Flipper (~> 0.33.1)
    - FlipperKit/CppBridge
    - FlipperKit/FBCxxFollyDynamicConvert
    - FlipperKit/FBDefines
    - FlipperKit/FKPortForwarding
  - FlipperKit/CppBridge (0.33.1):
    - Flipper (~> 0.33.1)
  - FlipperKit/FBCxxFollyDynamicConvert (0.33.1):
    - Flipper-Folly (~> 2.1)
  - FlipperKit/FBDefines (0.33.1)
  - FlipperKit/FKPortForwarding (0.33.1):
    - Flipper-PeerTalk (~> 0.0.4)
  - FlipperKit/FlipperKitHighlightOverlay (0.33.1)
  - FlipperKit/FlipperKitLayoutPlugin (0.33.1):
    - FlipperKit/Core
    - FlipperKit/FlipperKitHighlightOverlay
    - FlipperKit/FlipperKitLayoutTextSearchable
  - FlipperKit/FlipperKitLayoutTextSearchable (0.33.1)
  - FlipperKit/FlipperKitNetworkPlugin (0.33.1):
    - FlipperKit/Core
  - FlipperKit/FlipperKitReactPlugin (0.33.1):
    - FlipperKit/Core
  - FlipperKit/FlipperKitUserDefaultsPlugin (0.33.1):
    - FlipperKit/Core
  - FlipperKit/SKIOSNetworkPlugin (0.33.1):
    - FlipperKit/Core
    - FlipperKit/FlipperKitNetworkPlugin
  - FlipperKit (~> 0.33.1)
  - FlipperKit/FlipperKitLayoutPlugin (~> 0.33.1)
  - FlipperKit/FlipperKitReactPlugin (~> 0.33.1)
  - FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.33.1)
  - FlipperKit/SKIOSNetworkPlugin (~> 0.33.1)
    - Flipper
    - Flipper-DoubleConversion
    - Flipper-Folly
    - Flipper-Glog
    - Flipper-PeerTalk
    - Flipper-RSocket
    - FlipperKit
  Flipper: 6c1f484f9a88d30ab3e272800d53688439e50f69
  Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
  Flipper-Folly: 2de3d03e0acc7064d5e4ed9f730e2f217486f162
  Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
  Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
  Flipper-RSocket: 1260a31c05c238eabfa9bb8a64e3983049048371
  FlipperKit: 6dc9b8f4ef60d9e5ded7f0264db299c91f18832e

@ouabing
Copy link

ouabing commented Mar 27, 2020

I encounter this issue even when not targeting MacOS with react-native 0.62.0.

image

Previous definition is in iOS 13.2 header file iOS 13.2 > usr/include > time.h > clockid_t .

> cat Podfile.lock | grep -i flipper
  - Flipper (0.35.0):
    - Flipper-Folly (~> 2.1)
    - Flipper-RSocket (~> 1.0)
  - Flipper-DoubleConversion (1.1.7)
  - Flipper-Folly (2.1.1):
    - Flipper-DoubleConversion
    - Flipper-Glog
  - Flipper-Glog (0.3.6)
  - Flipper-PeerTalk (0.0.4)
  - Flipper-RSocket (1.0.0):
    - Flipper-Folly (~> 2.0)
  - FlipperKit (0.35.0):
    - FlipperKit/Core (= 0.35.0)
  - FlipperKit/Core (0.35.0):
    - Flipper (~> 0.35.0)
    - FlipperKit/CppBridge
    - FlipperKit/FBCxxFollyDynamicConvert
    - FlipperKit/FBDefines
    - FlipperKit/FKPortForwarding
  - FlipperKit/CppBridge (0.35.0):
    - Flipper (~> 0.35.0)
  - FlipperKit/FBCxxFollyDynamicConvert (0.35.0):
    - Flipper-Folly (~> 2.1)
  - FlipperKit/FBDefines (0.35.0)
  - FlipperKit/FKPortForwarding (0.35.0):
    - Flipper-PeerTalk (~> 0.0.4)
  - FlipperKit/FlipperKitHighlightOverlay (0.35.0)
  - FlipperKit/FlipperKitLayoutPlugin (0.35.0):
    - FlipperKit/Core
    - FlipperKit/FlipperKitHighlightOverlay
    - FlipperKit/FlipperKitLayoutTextSearchable
  - FlipperKit/FlipperKitLayoutTextSearchable (0.35.0)
  - FlipperKit/FlipperKitNetworkPlugin (0.35.0):
    - FlipperKit/Core
  - FlipperKit/FlipperKitReactPlugin (0.35.0):
    - FlipperKit/Core
  - FlipperKit/FlipperKitUserDefaultsPlugin (0.35.0):
    - FlipperKit/Core
  - FlipperKit/SKIOSNetworkPlugin (0.35.0):
    - FlipperKit/Core
    - FlipperKit/FlipperKitNetworkPlugin
  - FlipperKit (~> 0.35.0)
  - FlipperKit/FlipperKitLayoutPlugin (~> 0.35.0)
  - FlipperKit/FlipperKitReactPlugin (~> 0.35.0)
  - FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.35.0)
  - FlipperKit/SKIOSNetworkPlugin (~> 0.35.0)
    - Flipper
    - Flipper-DoubleConversion
    - Flipper-Folly
    - Flipper-Glog
    - Flipper-PeerTalk
    - Flipper-RSocket
    - FlipperKit
  Flipper: fec57c9ad921e8153f394980d3169aff51010513
  Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
  Flipper-Folly: 2de3d03e0acc7064d5e4ed9f730e2f217486f162
  Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
  Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
  Flipper-RSocket: 1260a31c05c238eabfa9bb8a64e3983049048371
  FlipperKit: 7c830ab52167e33faa1a8aac76834a89e73af08f

@kirill-konshin
Copy link

kirill-konshin commented Mar 28, 2020

Any workaround? I'm getting same thing Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t') with "react-native": "0.62.0" on a Mac target.

On a side note, error only occurs when running from XCode, it works when I run it like this: xcodebuild -workspace XXX.xcworkspace -configuration Debug -scheme XXX -destination id=XXXX-XXXX"

@kesha-antonov
Copy link

Same

@ericschaal
Copy link

ericschaal commented Mar 28, 2020

Same :(

EDIT:
Found a quick&dirty workaround
Looking a few lines above the clockit_t typedef in Flipper-Foly Time.h

// OSX is a pain. The XCode 8 SDK always declares clock_gettime
// even if the target OS version doesn't support it, so you get
// an error at runtime because it can't resolve the symbol. We
// solve that by pretending we have it here in the header and
// then enable our implementation on the source side so that
// gets linked in instead.
#if __MACH__ &&                                                \
    (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 || \
     __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)

#ifdef FOLLY_HAVE_CLOCK_GETTIME
#undef FOLLY_HAVE_CLOCK_GETTIME
#endif

#define FOLLY_HAVE_CLOCK_GETTIME 1
#define FOLLY_FORCE_CLOCK_GETTIME_DEFINITION 1

#endif

I changed __IPHONE_10_0 to __IPHONE_12_0 (as my target iOS version is 11) and got it working. I guess the same can be done for MAC_OS_X_VERSION_10_12 to MAC_OS_X_VERSION_10_15 if you are targeting macOS.

@passy
Copy link
Member

passy commented Mar 29, 2020

cc @priteshrnandgaonkar Can you take a look?

dpwiese added a commit to dpwiese/react-native-catalyst that referenced this issue Mar 31, 2020
- Flipper errors when building for macos target
- See: facebook/flipper#834
@cayodonatti
Copy link

Same here for react-native 0.62. Only happens when I change my iOS deployment target from 9.0 to 10.3 (or anything above 9.0). Deployment target change is needed to install some dependencies for my project.

@kirill-konshin
Copy link

@cayodonatti in my case even 9.0 fails.

@ifsnow
Copy link

ifsnow commented Apr 2, 2020

In my case, After changing iOS Deployment Target of Flipper-Folly Pods to "iOS 9.0", this error disappeared.
time_error

@kirill-konshin
Copy link

image
image

@ifsnow
Copy link

ifsnow commented Apr 3, 2020

@kirill-konshin Did you change the values of other Pods? Default values are as follows.

  • Flipper : iOS 8.0
  • Flipper-DoubleConvension : iOS 8.0
  • Flipper-Folly : iOS 8.0
  • Flipper-Glog : iOS 8.0
  • Flipper-PeerTalk : iOS 8.4
  • Flipper-RSocket : iOS 8.0
  • FlipperKit : iOS 9.0
  • Folly : iOS 9.0

Try changing these values, too. I hope it works out.

@kirill-konshin
Copy link

Yes, all of them

@priteshrnandgaonkar
Copy link
Contributor

I created a brand new react-native app on version 0.62 and it built successfully and connected to Flipper. I will need more specific repro steps so that I can look into it.

Bytw with 0.62 version RN supports Flipper out of the box. You don't have to do anything, so don't update the podfile's, it is done automatically.

Looking forward for detailed repro steps so that I can look into it.

@cayodonatti
Copy link

@priteshrnandgaonkar this is what needs to be changed to repro:

platform :ios, '10.3' # was 9.0
require_relative '../../../node_modules/@react-native-community/cli-platform-ios/native_modules'

def add_flipper_pods!
  version = '~> 0.33.1'
  pod 'FlipperKit', version, :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug'
  pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug'
end

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

target 'v1' do
  # Pods for v1
  pod 'FBLazyVector', :path => "../../../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../../../node_modules/react-native/Libraries/FBReactNativeSpec"
  
  ...

  use_native_modules!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  add_flipper_pods!
  post_install do |installer|
    flipper_post_install(installer)
  
    # this post build is necessary for other dependencies to work, since they use api's not available in 9.0 
    installer.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.3'
          config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end
  end
end

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

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

Also had to change the main project to 10.3

@cayodonatti
Copy link

Btw, I maintain my project since react-native 0.55 and this was never an issue. Deployment target version change is needed for a very big amount of libs in the RN ecosystem

@priteshrnandgaonkar
Copy link
Contributor

@cayodonatti I changed the deployment target of the app to 10.3 and it built for me. I just built created the brand new react native app and updated the deployment target.

@cayodonatti
Copy link

cayodonatti commented Apr 3, 2020

@priteshrnandgaonkar you need to add the postbuild hook, else it doesn't change the deployment target for the dependencies

installer.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.3'
      end
    end

@priteshrnandgaonkar
Copy link
Contributor

@cayodonatti I was able to repro it with your podfile changes. I am looking into it.

@priteshrnandgaonkar
Copy link
Contributor

@cayodonatti Why do you have to update the dependencies to 10.3. Ideally one shouldn't update the deployment target of dependencies, isn't it ?

@cayodonatti
Copy link

@priteshrnandgaonkar In my specific case, I have two dependencies that require bumping of deployment targets:

react-native-onesignal
react-native-ble-plx

I'm by no means an iOS developer, so I wouldn't know why that's needed. From personal experience, if I do not bump deployment target for all dependencies CocoaPods doesn't let me even install them and complains that some dependencies have different deployment target requirements than the project.

Also, this fix posted above fixes the issue for me:

Same :(

EDIT:
Found a quick&dirty workaround
Looking a few lines above the clockit_t typedef in Flipper-Foly Time.h

// OSX is a pain. The XCode 8 SDK always declares clock_gettime
// even if the target OS version doesn't support it, so you get
// an error at runtime because it can't resolve the symbol. We
// solve that by pretending we have it here in the header and
// then enable our implementation on the source side so that
// gets linked in instead.
#if __MACH__ &&                                                \
    (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 || \
     __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)

#ifdef FOLLY_HAVE_CLOCK_GETTIME
#undef FOLLY_HAVE_CLOCK_GETTIME
#endif

#define FOLLY_HAVE_CLOCK_GETTIME 1
#define FOLLY_FORCE_CLOCK_GETTIME_DEFINITION 1

#endif

I changed __IPHONE_10_0 to __IPHONE_12_0 (as my target iOS version is 11) and got it working. I guess the same can be done for MAC_OS_X_VERSION_10_12 to MAC_OS_X_VERSION_10_15 if you are targeting macOS.

Which leads me to think this could be a macro issue.

@priteshrnandgaonkar
Copy link
Contributor

@cayodonatti, there shouldn't be a need to update the deployment targets of dependencies, it feels like the way you are integrating those libraries may not be correct. You can change the platform :ios, '10.3' # was 9.0 to 10.3 and it will work, but changing the iOS deployment target of dependencies seems unnecessary.

@cayodonatti
Copy link

cayodonatti commented Apr 3, 2020

@priteshrnandgaonkar I dug up my old code, and found the specific dep that requires iOS 10: https://github.com/Adyen/adyen-ios/blob/master/Adyen.podspec

It's a native pod which I built my own bridge for. Anyway, this does not change the fact that I need to set my project to iOS 10+, since this is a payment thing and is needed for the app functionality.

As I said, with the change above it works as intended.

Edit: just adding to it, it is a very simple bridge which doesn't fiddle with any config on the native part. It's just the Adyen pod that has a strict requirement of iOS 10+, prolly because of some encrypt thing they use which was added later than 9.0.

@priteshrnandgaonkar
Copy link
Contributor

Still I will see if just changing your app's deployment target to 10+ works or not ? I don't think there should be a need to change all the deps to 10+ due to that.

@cayodonatti
Copy link

I'll test it and report ASAP. I think I did a bunch of changes at once and didn't test it thoroughly, will do it now.

Thank you very much for the help

@kirill-konshin
Copy link

kirill-konshin commented Apr 3, 2020

I have installed my project from scratch from template, I have no custom pods or anything special. Yet no matter which target I set I get same error.

image

I commented out this line and got this:

ld: warning: directory not found for option '-L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst'
ld: in /xxx/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/xxx/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture x86_64

@cayodonatti
Copy link

@priteshrnandgaonkar just confirming: the post-install hook is not really needed, and my project just ran fine without it with some minor adjustments. Thank you for your patience and for the help!

@kesha-antonov
Copy link

kesha-antonov commented Aug 16, 2021

IOS_VERSION = '11.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['IPHONEOS_DEPLOYMENT_TARGET'] = IOS_VERSION
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
    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

Helped

@ospfranco
Copy link

For those facing some issues on RN 0.65 the answer posted by kesha-antonov is correct, but he didn't explain why:

case target.name
    when 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end

If you have some code that changes your pods deployment target it will fail for RCT-Folly it is important that it remains targeting 9.0, so whatever you do, that needs to be there

@milesscherrer
Copy link

For RN 0.65, still getting same error with workaround. No problem building on RN 0.64.2. Cleaned out everything and same podfile as @kesha-antonov and also tried with different flipper versions.

@singh-prabh
Copy link

For RN 0.65, still getting same error with workaround. No problem building on RN 0.64.2. Cleaned out everything and same podfile as @kesha-antonov and also tried with different flipper versions.

same for me....

@captainDuckay
Copy link

For RN 0.65, still getting same error with workaround. No problem building on RN 0.64.2. Cleaned out everything and same podfile as @kesha-antonov and also tried with different flipper versions.

Same here

@hardworker
Copy link

hardworker commented Aug 19, 2021

@ospfranco
According to node_modules/react-native/third-party-podspecs/RCT-Folly.podspec it works well only with 9.0 target:

  # Folly has issues when compiled with iOS 10 set as deployment target
  # See https://github.com/facebook/folly/issues/1470 for details
  spec.platforms = { :ios => "9.0", :tvos => "9.0" }

So the problem occurs only if you set the deployment target for RCT-Folly higher than iOS 9.0 because of this macro in Time.h:

#if __MACH__ &&                                                       \
        ((!defined(TARGET_OS_OSX) || TARGET_OS_OSX) &&                \
         (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)) || \
    (TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)) <-- last condition fails

That leads to unsetting FOLLY_HAVE_CLOCK_GETTIME and redefinition occurs

@mikehardy
Copy link

mikehardy commented Aug 20, 2021

  post_install do |installer|
    react_native_post_install(installer)

    # We need to make one crude patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1
    # https://github.com/facebook/flipper/issues/834 - 84 comments and still going...
    `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
  end

(85 comments now! 😆 )

@yvbeek
Copy link

yvbeek commented Aug 25, 2021

This is what I'm using:

post_install do |installer|
  # Run the React-Native post install
  react_native_post_install(installer)

  # Reconfigure the pods to match the iOS version we're targetting
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      case target.name
      when 'RCT-Folly'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      else
        config.build_settings.delete('IPHONEOS_DEPLOYMENT_TARGET')
      end
    end
  end
end

By removing the deployment target definition from the other pods, they will inherit that setting from the project.

@mikehardy
Copy link

@yvbeek that sounds like a good idea, but then when you have a deployment target too low, you will get a problem - also in RCT-Folly (F14Table.mm) with thread-local storage not being available on the platform. Examine the interplay between the various things in the comments on my full set of post_install hacks at the moment (tested + working on react-native 0.65.1 + Xcode 12.5/13beta5 + arm64/x86_64 macs)

 post_install do |installer|
    react_native_post_install(installer)

    # Apple Silicon builds require a library path tweak for Swift library discovery or "symbol not found" for swift things
    installer.aggregate_targets.each do |aggregate_target| 
      aggregate_target.user_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
        end
      end
      aggregate_target.user_project.save
    end

     # Flipper requires a crude patch to bump up iOS deployment target, or "error: thread-local storage is not supported for the current target"
    # I'm not aware of any other way to fix this one other than bumping iOS deployment target to match react-native (iOS 11 now)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
       end
    end

    # ...but if you bump iOS deployment target, Flipper barfs again "Time.h:52:17: error: typedef redefinition with different types"
    # We need to make one crude patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1
    # https://github.com/facebook/flipper/issues/834 - 84 comments and still going...
    `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
  end

@yvbeek
Copy link

yvbeek commented Aug 25, 2021

@mikehardy In our project we're using iOS 11, which I believe is now the recommended deployment target for the latest React-Native. I'm honestly not sure if React-Native still supports anything under iOS 10. For Folly the deployment target is set to iOS 9.

@mikehardy
Copy link

I'm also set to 11. I needed each of those things in my post install 🤷

@amitsharma-007
Copy link

Any Solutions?

@mikehardy
Copy link

@amitsharma-007 yeah, code with fancy highlighting right above, did you see it?

`sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`

@litinskii
Copy link

@mikehardy You are rock =)

@mikehardy
Copy link

@litinskii hahaha thanks

For what it's worth - anyone following along here should know I worked with the react-native release crew and this workaround (as well as the 2 others required currently for iOS builds) will be in the podfile template for new projects, and available for existing projects to call as a method from react-native core as a temporary workaround, but officially recognized, until the whole underlying issue is sorted.

react-native-community/releases#246 (comment)
facebook/react-native@ac4ddec

Stated differently: the underlying problem is now very visible and should be fixed 🤞

@kadanes
Copy link

kadanes commented Sep 5, 2021

I am still getting this error after adding the react_native_post_install script. I think the package name needs to be Flipper-Folly instead of RCT-Folly. I have added this to my Pod file: use_flipper!({ 'Flipper' => '0.74.0' }), and my React-Native version is 0.65.1

sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/Flipper-Folly/folly/portability/Time.h

@usama-homage
Copy link

@mikehardy tried your solution but facing the same issue

sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h

@mikehardy
Copy link

@usama-homage

tried

https://stackoverflow.com/help/minimal-reproducible-example

apologies for the brevity - but it works for me from clean project init (I test via scripts) so burden is on you to show reproducible example please - can fix if problem is demonstrated

@sezginriggs
Copy link

I'm also having the same problem with react native 0.65.1.

@mikehardy
Copy link

mikehardy commented Sep 7, 2021

Please, before posting a metoo, someoe please post a reproduction? Because I have scripted / reproducible success with this:

https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

(actually - this commit if you are using react-native 0.65.1 mikehardy/rnfbdemo@3666d0e#diff-3e27ae623577d0c559bd8ab973a0c34af8cc65ef9beb9868a9cdb029854f8078 - the following commit is where I move to react-native 0.66.0-rc.1 since it incorporates my workarounds)

To be completely clear: metoos have no value, reproducible examples posted as github repos have tremendous value.

If there's no reproduction, there's no fix.

@sezginriggs
Copy link

sezginriggs commented Sep 7, 2021

@mikehardy I've created another repo with the exact same code/project and invited you as collaborator. I guess & hope you can use it to reproduce error.

@mikehardy
Copy link

reproductions for public issues need to be public repos, sorry. Can you post a public repo starting from npx react-native init FlipperRedefRepro or similar?

@mweststrate
Copy link
Contributor

mweststrate commented Sep 8, 2021

The clockid_t issue was solved in my case by bumping Flipper-Folly from 2.6.7 to 2.6.9. You can use this Podfile for reference how to do that.

In general, this Podfile is how we assert build compatibility between React Native and Flipper, so feel free to use it as reference point for future issues.

Note that this doesn't solve the M1 issues, for which this patch can be used.

On the long term we are working currently to become less/not reliant on Folly, which seems one of the biggest causes of build issues so far. Will try to share more details soon.

@camdagr8
Copy link

For me I had to comment these lines in Podfile and it worked!

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

One more thing everyone forget to mention: don't forget to update repo

cd ios && pod install --repo-update 

At least this command did the trick for me

Thanks Hero!

@usama-homage
Copy link

usama-homage commented Sep 14, 2021

@mikehardy I tried to copy your Podfile. but faced this issue.

Screenshot 2021-09-14 at 2 51 29 PM

just for reference here is what my Podfile looks like.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
inhibit_all_warnings! #added to remove unneccesory pods warning

install! 'cocoapods',
:deterministic_uuids => false
use_frameworks!

flipperkit_version = '0.108.0'

target 'TargetName' do
  
  use_modular_headers!
  
  config = use_native_modules!
  
  use_react_native!(:path => config["reactNativePath"], :hermes_enabled => true)
  
  pod 'Alamofire', '~> 4.9.1'
  pod 'AlamofireImage'
  pod 'Amplitude-iOS'
  pod 'Branch'
  pod 'Contentful'
  pod 'FirebaseCrashlytics'
  pod 'DKPhotoGallery'
  pod 'SDWebImage', '~> 5.10.4'
  pod 'DateToolsSwift'
  pod 'DeviceKit'
  pod 'FSCalendar'
  pod 'Firebase'
  pod 'Firebase/Auth'
  pod 'Firebase/Core'
  pod 'Firebase/Database'
  pod 'Firebase/Performance'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Storage'
  pod 'GrowingTextView'
  pod 'KDCalendar'
  pod 'MBProgressHUD'
  pod 'Mixpanel-swift'
  pod 'OneSignal'
  pod 'PhoneNumberKit'
  pod 'ReachabilitySwift'
  pod 'RxCocoa'
  pod 'RxSwift'
  pod 'UIScrollView-InfiniteScroll'
  pod 'ZendeskSupportSDK'
  pod 'lottie-ios'
  pod 'SwiftSignatureView'
  pod 'TwilioVideo'
  pod 'IQKeyboardManagerSwift'
  pod 'UITextView+Placeholder'
  
  use_flipper!({ 'Flipper' => flipperkit_version,
               'Flipper-Folly' => '2.6.9',
               'Flipper-RSocket' => '1.4.3',
               'Flipper-DoubleConversion' => '3.1.7',
               'Flipper-Glog' => '0.3.9',
               'Flipper-PeerTalk' => '0.0.4' })
               
   post_install do |installer|
     react_native_post_install(installer)
   end
               
end

@mikehardy
Copy link

You have version locks all over for the use_flipper section. If it's not working I imagine it's because of that. My versions were unlocked, I just have that one sed file edit in combo with the deployment target raise, and flipper compile goes through for me.

@mweststrate
Copy link
Contributor

@usama-homage the problem is that your Podfile uses use_frameworks!, which is currently not supported by react-native. Follow allong with #2414 for that.

Beyond that, let's not post new symptoms in closed issues. it makes the thread impossible to read. Please open new issues, with repro steps and linking to whatever closed issues that seems relevant.

@facebook facebook locked and limited conversation to collaborators Sep 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests