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

Unable to integrate SDKs into React Native 0.61.5 - Undefined symbols for architecture x86_64 #816

Closed
ghost opened this issue Feb 20, 2020 · 10 comments
Assignees

Comments

@ghost
Copy link

ghost commented Feb 20, 2020

🐛 Bug Report

We have a standard React Native 0.61.5. When we try to integrate Flipper into the iOS part of the app with the guide provided here - https://fbflipper.com/docs/getting-started.html#setup-your-react-native-app we get the following error:

undef: _OBJC_CLASS_$_FlipperKitNetworkPlugin
undef: _OBJC_CLASS_$_SKIOSNetworkAdapter
undef: _OBJC_CLASS_$_FlipperKitReactPlugin
undef: _OBJC_CLASS_$_FKUserDefaultsPlugin
undef: _OBJC_CLASS_$_FlipperKitLayoutPlugin
undef: _OBJC_CLASS_$_SKDescriptorMapper
undef: _OBJC_CLASS_$_FlipperClient
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKIOSNetworkAdapter", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in AppDelegate.o

We use the Objective-C integration in AppDelegate.m.

Any idea why that would be happening?

Environment

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
    Memory: 412.38 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
    Yarn: 1.22.0 - ~/.yarn/bin/yarn
    npm: 6.2.0 - ~/.nvm/versions/node/v10.9.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 19, 22, 23, 25, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5
  npmGlobalPackages:
    react-native: 0.61.5
@priteshrnandgaonkar priteshrnandgaonkar self-assigned this Feb 20, 2020
@priteshrnandgaonkar
Copy link
Contributor

Let me try to reproduce it. I will try making a new app and integrate it with the instructions mentioned in our docs.

If you have particular repro steps, do let me know.

@ghost
Copy link
Author

ghost commented Feb 20, 2020

Nothing specific added, just the init call and the initializeFlipper method in the AppDelegate.m plus the installation of the pods according to the docs. I also added an empty swift file in the project as it was failing because of Swift before that.

@priteshrnandgaonkar
Copy link
Contributor

priteshrnandgaonkar commented Feb 20, 2020

I did the following additional steps which is not listed in that doc which made the RN integration work.

Rather than adding empty swift file I added the following

  • /usr/lib/swift as the first entry of the LD_RUNPATH_SEARCH_PATHS
  • Added the following entries in LIBRARY_SEARCH_PATHS
 "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)"
 "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"
  • set DEAD_CODE_STRIPPING to Yes

I will update the docs with this information. These are some of the steps which are written in objc integration too. Having said that, I was not able to repro the errors which you have posted above.

Screen Shot 2020-02-20 at 5 02 39 PM

@ghost
Copy link
Author

ghost commented Feb 21, 2020

Tried this but doesn't quite work unfortunately. I will await the next version of Flipper or RN, might be related to something within our current setup of these two.

facebook-github-bot pushed a commit that referenced this issue Feb 21, 2020
Summary:
Updated documentation for RN.

This fixes the documentation issue posted here #816

Reviewed By: mweststrate

Differential Revision: D20007620

fbshipit-source-id: 118e62450ad0c99346277d5205d637b7ecbae5c6
@pix2D
Copy link

pix2D commented Mar 28, 2020

Having the same (similar?) issue when updating my React Native 0.61.5 project to 0.62:

Undefined symbols for architecture x86_64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've set LD_RUNPATH_SEARCH_PATHS and LIBRARY_SEARCH_PATHS per the docs, as well as DEAD_CODE_STRIPPING to YES.

@pix2D
Copy link

pix2D commented Mar 28, 2020

I was able to get it working by following react-native-community/upgrade-helper#191. The thing that fixed it for me was adding a empty swift file to the project through Xcode which created some kind of bridging header.

@priteshrnandgaonkar
Copy link
Contributor

Closing this issue as it is solved in recent versions of 0.62

@matinzd
Copy link

matinzd commented Apr 23, 2020

Build succeeds but app crashes after a while!
https://pastebin.com/uwHgZJQj

@maxckelly
Copy link

I'm also getting this issue, has anyone found a solution?

@Murtaza-arif
Copy link

Murtaza-arif commented Nov 26, 2020

I did the following additional steps which is not listed in that doc which made the RN integration work.

Rather than adding empty swift file I added the following

  • /usr/lib/swift as the first entry of the LD_RUNPATH_SEARCH_PATHS
  • Added the following entries in LIBRARY_SEARCH_PATHS
 "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)"
 "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"
  • set DEAD_CODE_STRIPPING to Yes

I will update the docs with this information. These are some of the steps which are written in objc integration too. Having said that, I was not able to repro the errors which you have posted above.

Screen Shot 2020-02-20 at 5 02 39 PM

How to do the first step

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

5 participants