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

Created on 26 Feb 2020  ·  78Comments  ·  Source: facebook/flipper

🐛 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

Most helpful comment

why this is still an issue :/

@ShivamJoker try using like this in podfile

  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

and then run pod install --repo-update

https://github.com/facebook/flipper/issues/2215#issuecomment-829102757

All 78 comments

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?

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

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

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"

Same

Same :(

EDIT:
Found a quick&dirty workaround
Looking a few lines above theclockit_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.

cc @priteshrnandgaonkar Can you take a look?

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.

@cayodonatti in my case even 9.0 fails.

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

image
image

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

Yes, all of them

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.

@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

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

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

@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

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

@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 ?

@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 theclockit_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.

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

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

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.

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

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

@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!

@cayodonatti Can you summarise how to fix issue or do a quick&dirty workaround?

Yes please. Because Flipper has too many problems on iOS

FWIW my quick-and-dirty workaround is adding this during build phase to patch that file on the fly (we target 11.4):

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

I changed Podfile for platform :ios, '10.3'
nothing
changed the __IPHONE_12_0
nothing
Clean build
nothing
Change projet target to iOS 10.3
nothing

I am not able to repro this unless I change the target iOS version of the Flipper dependencies, which shouldn't be necessary. Changing the target iOS version of the Flipper dependency shouldn't be necessary.

If just changing the target iOS version of the app causes the above problem, then please provide me with a reproducible sample. I will take a look, closing this issue till then.

Commented out that line and it compiled.

//typedef uint8_t clockid_t;
extern "C" int clock_gettime(clockid_t clk_id, struct timespec* ts);
extern "C" int clock_getres(clockid_t clk_id, struct timespec* ts);
#endif

I have this exact same issue.
Here is the stack:

MacOS: 10.15.4
Xcode: 11.4
RN: 0.62.0-rc.5
RN Cli: 4.8.0

iOS app works just fine. But when I select mac as a target build fails.

First it failed with Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t').

Then I commented out the the following line:

//typedef uint8_t clockid_t;
extern "C" int clock_gettime(clockid_t clk_id, struct timespec* ts);
extern "C" int clock_getres(clockid_t clk_id, struct timespec* ts);
#endif

Then tried to build again and got the following error:

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 /Users/jh/Documents/projects/VST/Trial3/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/Users/jh/Documents/projects/VST/Trial3/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is the default boilerplate app created via react-native init.

Does ReactNative support Project Catalyst at all? If yes, should I do something to properly migrate to mac target?

Having the same problem. I also want to say that as Flipper was introduced as an integral part of react-native, it only introduced problems.

I'm even using a 3rd-party SDK and Flipper causes issues there. Is there a way to completely strip Flipper out of your RN project?

If you are using react-native-flipper, make sure to upgrade to 0.45.

Pretty sure flipper can be stripped out by removing the call to add_flipper_pods and flipper_post_install in your Podfile.

For any further follow up questions, please open a new issue as this one is closed.

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

It's worked

Fixed xD

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

Fixed xD

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

Are there any drawbacks of commenting out these lines?

@sauhardar
Many projects have it in Podfile because it comes with react-native tutorial.
Most developers don't really use it. So when it creates problem, easier to remove it than search for workarounds.

I didn't get any drawbacks.

you'll just need to update XCode to latest, it is working on XCode 12.4

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

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

I'd also never previously used Flipper, nor have I spent the time yet to figure out whether I should be using it. 🙂

Just comment these lines in Pods file

use_flipper!

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

then run this command
cd ios && pod install

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

Para mim tive que comentar essas linhas no Podfile e funcionou!

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

Mais uma coisa que todos esquecem de mencionar: não se esqueça de atualizar o repo

cd ios && pod install --repo-update 

Pelo menos este comando funcionou para mim

This works for me! thx bro!

Amazing solution!!

Same issue ejected from expo today using:

expo prebuild -p ios

It wouldn't build even after upgrading flipper to the latest 0.87.0. Does flipper support iOS 14.5? Is that the issue.

Commenting out flipper did fix the issue. Would be great to be able to actually use flipper as it seems pretty useful

Same issue ejected from expo today using:

expo prebuild -p ios

It wouldn't build even after upgrading flipper to the latest 0.87.0. Does flipper support iOS 14.5? Is that the issue.

Commenting out flipper did fix the issue. Would be great to be able to actually use flipper as it seems pretty useful

I got the same error when upgraded xcode, which now supports iOS 14.5

same issue

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

This worked for me :)

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 to this, I was able to resolve the error.

why this is still an issue :/

why this is still an issue :/

@ShivamJoker try using like this in podfile

  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

and then run pod install --repo-update

https://github.com/facebook/flipper/issues/2215#issuecomment-829102757

I was seeing this issue on React Native 0.63.4 after updating to XCode 12.5. I had made some other changes (namely integrating this commit), and although the Podfile changes to pass the newer versions into use_flipper! did some one of the compilation errors I was seeing, I was still seeing the "Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')" error.

What worked for me was something I found from this code comment. I had to update Folly.podspec to target iOS 9 instead of iOS 10 for some reason.

why this is still an issue :/

@ShivamJoker try using like this in podfile

  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

and then run pod install --repo-update

#2215 (comment)

This worked for me, ty @sturmenta

@priteshrnandgaonkar any chance you could reopen this issue? I can confirm that this is happening again with Xcode 12.4 on an iOS repo.

Does it happen with our test project as well on your end? As found in
react-native/ReactNativeFlipperExample in this repo. Otherwise without
reproduction it is hard to make it actionable.

On Mon, 3 May 2021, 10:24 Olivier Louvignes, @.*>
wrote:

@priteshrnandgaonkar https://github.com/priteshrnandgaonkar any chance
you could reopen this issue? I can confirm that this is happening again.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flipper/issues/834#issuecomment-831137722,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAN4NBEVIUQTPRH6GUKAKA3TLZTVVANCNFSM4K4K5O7A
.

@mweststrate as of today it breaks on any new react-native iOS application, without touching flipper's version in the Podfile.

To reproduce (0.64.0 is latest as of today), with Xcode 12.4:

npx react-native init AwesomeProject --version 0.64.0
cd AwesomeProject
npm run ios

Screenshot 2021-05-03 at 15 38 41

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

Same :(

EDIT:
Found a quick&dirty workaround
Looking a few lines above theclockit_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.

Worked for me as well, rn 0.64, thanks.

image
if you change versions in your lock file to this from yesterday, it will work...

Quick fix, while waiting for an update :

Comment line 52 in Pods/Flipper-Folly/Time.h

//typedef uint8_t clockid_t;

(Just updated all my dependencies and Pods today)

I do:

  1. remove pods in ios folder by pod deintegrate and remove podfile.lock
  2. remove node_modules and yarn.lock
  3. clean all pods cashes pod cache clean --all / or you can clean just Flipper pod by pod cache clean 'Flipper' --all
  4. write settings for download the same version of Flipper in Podfile use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.81.0', 'Flipper-RSocket' => '1.3.1' })
  5. yarn install -> yarn build:ios -> yarn ios

It`s work for me

Still does not work with above solutions, except only if I patch it locally.
But I run my builds through deploy pipelines and I don't have access to Pods.
Have to remove this for for now 👍

@alexandrughinea React-Native 0.64.1 is out, try to update. Everything is working fine now

i have the issue on ios 14.5 but before that it was building fine, but for me it was flipper, so removing it seems fine.

why this is still an issue :/

@ShivamJoker try using like this in podfile

  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

and then run pod install --repo-update

#2215 (comment)

It's amazing

why this is still an issue :/

@ShivamJoker try using like this in podfile

  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

and then run pod install --repo-update

#2215 (comment)

nice solution for react native version 0.63.4 and xcode version 12.5 ios 14.5

Same :(

EDIT:
Found a quick&dirty workaround
Looking a few lines above theclockit_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.

where do you add this? What file?

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 to this, I was able to resolve the error.

Thanks, you save my day

but, what happen for big project if we don't use flipper?

https://github.com/facebook/flipper/issues/834#issuecomment-830948313
It's work for me =)), Thanks!

Using this worked for me:

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
end

guys just bump your flipper version to the latest one in pod file:
use_flipper!({ 'Flipper' => '0.92.0' }) /// here
post_install do |installer|
flipper_post_install(installer)
and if not resolved then do pod update , it will fix my issue.

Guys for me the issue was with Flipper-Folly (2.6.7). I updated the pod file to use 2.5.1 version of Flipper-Folly (the compatible version with Flipper) like:

use_flipper!({ 'Flipper-Folly' => '2.5.1' })

Delete Podfile.lock and Pods and do a pod install and it should work.

This issue started for me after I ran pod update .

Installing Flipper-Boost-iOSX (1.76.0.1.11)
Installing Flipper-Fmt (7.1.7)
Installing Flipper-Folly 2.6.7 (was 2.5.1)
Installing Flipper-RSocket 1.4.3 (was 1.3.1)

Changing this in my pod file seems to have fixed it:

use_flipper!({ 'Flipper' => '0.92.0' }) // Was '0.79.1'

i am getting this error when i try to run xcodebuild with sdk iphonesimulator: xcodebuild -workspace App.xcworkspace -scheme App -configuration Debug -sdk iphonesimulator -derivedDataPath ./build -quiet

Error:

ios/Pods/Headers/Private/RCT-Folly/folly/portability/Time.h:52:17: error: 
      typedef redefinition with different types ('uint8_t' (aka 'unsigned char')
      vs 'enum clockid_t')
typedef uint8_t clockid_t;

/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;

I am using react-native 0.65.0-rc.2.

  • Flipper (0.93.0):

    • Flipper-Folly (~> 2.6)

    • Flipper-RSocket (~> 1.4)

Installing Flipper-Folly 2.6.7 (was 2.5.1)
Installing Flipper-RSocket 1.4.3 (was 1.3.1)

Changing this in my pod file seems to have fixed it:

use_flipper!({ 'Flipper' => '0.92.0' }) // Was '0.79.1'

@parthv21 Nice, that helped! Using these versions got rid of the error:

use_flipper!({ 'Flipper' => '0.92.0', 'Flipper-Folly' => '2.6.7',  'Flipper-RSocket' => '1.4.3' })
Was this page helpful?
0 / 5 - 0 ratings