upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

Use of undeclared identifier FlipperClient

Open rahulkasana opened this issue 4 years ago • 23 comments

Environment

System: OS: macOS 10.15.3 CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz Memory: 454.10 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.12.0 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.11.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 Android SDK: API Levels: 23, 25, 27, 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-29 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: Not Found Xcode: 10.0/10A255 - /usr/bin/xcodebuild Languages: Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.0 => 0.62.0 npmGlobalPackages: react-native: Not Found

Upgrading version

I'm upgrading from 0.59.8 to 0.62 manually. (Android works fine but IOS does not)

Description

I manually upgraded using this https://react-native-community.github.io/upgrade-helper/?from=0.59.8&to=0.62.0 and changed xcodeproject file using this step by step. https://github.com/react-native-community/upgrade-support/issues/13 But after finishing every steps and when i try to build i get this error.

Screenshot 2020-03-31 at 6 25 24 PM

And even if i comment this another error appears. ""_YGNodeHasMeasureFunc", referenced from: -[YGLayout markDirty] in libYogaKit.a(YGLayout.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) "

rahulkasana avatar Mar 31 '20 12:03 rahulkasana

Go to Build Settings Find Preprocessor Macros To Debug add new value: FB_SONARKIT_ENABLED=1

lorenc-tomasz avatar Mar 31 '20 13:03 lorenc-tomasz

@lorenc-tomasz I tried this. But I'm getting this error now.

Screenshot 2020-03-31 at 7 27 16 PM

rahulkasana avatar Mar 31 '20 13:03 rahulkasana

Remove this:

"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"

Add dummy / empty swift file. Will create bridge file if not exist. Leave the file within the project.

lorenc-tomasz avatar Mar 31 '20 14:03 lorenc-tomasz

having the same issue 🤔

ovy9086 avatar Mar 31 '20 15:03 ovy9086

Remove this:

"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"

Add dummy / empty swift file. Will create bridge file if not exist. Leave the file within the project.

@lorenc-tomasz I removed those 2 LIBRARY_SEARCH_PATHS and tried the build after adding the dummy swift file and running clean. Also this time it didn't asked for create bridging header for new file. And still got the same error.

rahulkasana avatar Mar 31 '20 15:03 rahulkasana

I had the same issue. The step above resolved my issue. Sorry that I couldn't help you :(

lorenc-tomasz avatar Mar 31 '20 15:03 lorenc-tomasz

Last idea.

Add this to Podfile

# 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
  file_name = Dir.glob("*.xcodeproj")[0]
  app_project = Xcodeproj::Project.open(file_name)
  app_project.native_targets.each do |target|
    target.build_configurations.each do |config|
      cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
      unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
        puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
        cflags << '-DFB_SONARKIT_ENABLED=1'
      end
      config.build_settings['OTHER_CFLAGS'] = cflags
    end
    app_project.save
  end
  installer.pods_project.save
end

lorenc-tomasz avatar Mar 31 '20 15:03 lorenc-tomasz

@lorenc-tomasz I really appreciate your help!!! THANKS A TON. I wanted to ask is there any way i can again get that dialog to create bridging header for new file. Tho i remember clicking it during following the link step by step.

rahulkasana avatar Mar 31 '20 15:03 rahulkasana

Screenshot 2020-03-31 at 9 31 10 PM

rahulkasana avatar Mar 31 '20 16:03 rahulkasana

As far I know it's not possible. But you can create AppName-Bridging-Header.h file. Then go to Build Settings and under Swift Compiler - General find option Objective-C bridging Header Add there AppName-Bridging-Header.h as a value.

lorenc-tomasz avatar Apr 01 '20 08:04 lorenc-tomasz

This bit me in my upgrade as well.

I needed FB_SONARKIT_ENABLED=1, I needed the "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)" library search paths, and I needed to maintain the dummy Swift file (not delete it) as well as enable dead code stripping per #25 - kind of a mess IMHO but I think it's working now.

Xcode is so difficult to deal with.

mikehardy avatar Apr 01 '20 23:04 mikehardy

The guide at https://fbflipper.com/docs/troubleshooting.html#build-errors-in-react-native may help you out, it removes the need of a dummy swift file.

lucasbento avatar Apr 02 '20 06:04 lucasbento

Following the instructions here (without deleting the bridging file at the end): https://github.com/react-native-community/upgrade-helper/issues/191

And adding FB_SONARKIT_ENABLED=1 resolved the issue for me.

tomasswood avatar Apr 03 '20 00:04 tomasswood

I'll have a look at the fbflipper.com guide - but a separate thought that's personal to my project is that when I saw that flipper was optional for 61 I skipped all of it. So it might be that I had a pent up set of changes necessary and it's my fault for not looking at the 60->61 changes more closely. I mention it because that might be the case for others as well

Final note, flipper pulls in the OpenSSL-Universal pod which causes bitcode-enabled debug builds to fail on real devices - related https://github.com/facebook/flipper/issues/485 (and how I became aware: https://github.com/invertase/react-native-firebase/issues/3384) - there are workarounds though in case others need them, specifically make sure bitcode is disabled for debug builds and then if you want it enabled on release builds I think you need dead code stripping too (I had a successful testflight build with bitcode enabled and dead code stripping on, anyway).

Hope this helps!

mikehardy avatar Apr 03 '20 00:04 mikehardy

Go to Build Settings Find Preprocessor Macros To Debug add new value: FB_SONARKIT_ENABLED=1

This worked for me! Thanks a bunch @lorenc-tomasz

EDIT: Did not solve it. stil back, and after create a new react native project for debugging and comparing the settings i found that a clean project does not use this? How come clean projects does not use it?

mansdahlstrom1 avatar Apr 03 '20 15:04 mansdahlstrom1

I followed everything said in this link https://github.com/react-native-community/upgrade-helper/issues/191 and added below lines

Go to Build Settings
Find Preprocessor Macros
To Debug add new value:
FB_SONARKIT_ENABLED=1

But, Still I'm getting the error

jamesawer3 avatar Jun 07 '20 06:06 jamesawer3

I fixed it by doing rm -rf /Users/{user}/Library/Developer/Xcode/DerivedData/{project_id}/Build/Products/Debug-iphonesimulator and building again

luisgrases avatar Jun 17 '20 23:06 luisgrases

@luisgrases then you'll love https://github.com/pmadruga/react-native-clean-project/ - don't try CI without it :-)

mikehardy avatar Jun 18 '20 00:06 mikehardy

Go to Build Settings Find Preprocessor Macros To Debug add new value: FB_SONARKIT_ENABLED=1

This should be added to https://react-native-community.github.io/upgrade-helper/

andrekovac avatar Jul 04 '20 11:07 andrekovac

I tried all the answer, but nothing is available...

jeremy-jm avatar Sep 09 '20 07:09 jeremy-jm

I fixed it by doing rm -rf /Users/{user}/Library/Developer/Xcode/DerivedData/{project_id}/Build/Products/Debug-iphonesimulator and building again Thanks, solved my problem

zhuiye avatar Sep 24 '20 02:09 zhuiye

Go to Build Settings Find Preprocessor Macros To Debug add new value: FB_SONARKIT_ENABLED=1

This worked like a charm, many thanks @lorenc-tomasz

pwaweru avatar Nov 21 '20 13:11 pwaweru

Go to Build Settings Find Preprocessor Macros To Debug add new value: FB_SONARKIT_ENABLED=1

It works for me

hahtml avatar Dec 11 '20 05:12 hahtml