Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find or use auto-linked library '..." after installing react-native-fbsdk

I am trying to install react-native-fbsdk via npm, and whereas my build worked perfectly before, once I install the library and install pods, I get the following error:

ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftsimd'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftPhotos'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftAVFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
ld: warning: Could not find or use auto-linked library 'swiftCoreMIDI'
ld: warning: Could not find or use auto-linked library 'swiftCoreLocation'
Undefined symbols for architecture x86_64:
  "protocol descriptor for Foundation.CustomNSError", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "method descriptor for static Foundation.CustomNSError.errorDomain.getter : Swift.String", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "method descriptor for Foundation.CustomNSError.errorUserInfo.getter : [Swift.String : Any]", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "method descriptor for Foundation.CustomNSError.errorCode.getter : Swift.Int", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "base conformance descriptor for Foundation.CustomNSError: Swift.Error", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "protocol descriptor for Foundation._ErrorCodeProtocol", referenced from:

... etc

I've searched everywhere for a solution to this problem and I am not seeing how to solve this library issue.

I am on React Native .60.5 - is there any solution for this problem?

like image 679
Steven Matthews Avatar asked May 24 '20 21:05

Steven Matthews


People also ask

How to fix React Native not working after updating?

Create a swift file in the main project (File.swift) and add the following code to the same In case you see the issue after updating React Native from 0.63.x to 0.64.x, try this solution: Compare package.json of the new project and of your old 0.63.x project, and modify the old one.

Where do I find the libraries in React Native?

All the libraries we ship with React Native live on the Libraries folder in the root of the repository. Some of them are pure JavaScript, and you only need to require it.

Do I need a React-Native link anymore?

According to the official announcement “The team working on the React Native CLI has introduced major improvements to native module linking called auto-linking! Most scenarios will not require the use of a react-native link anymore.” So to conclude there is no linking anymore but there are some additional changes also let’s see the example.

How do I call a library from a native project?

If you do need to call it from native, then we need to know the library's headers. To achieve that you have to go to your project's file, select Build Settings and search for Header Search Paths. There you should include the path to your library.


2 Answers

To resolve this problem you just need to add swift file and ** "Create Bridging Header"** in your Xcode project.

  • open Xcode and under you project select New file and select swift file
  • now clean your build and make new build.

Or you can see bellow link to understand this so well

Why linker link static libraries with errors? iOS

like image 60
Sakshi Singh Avatar answered Oct 09 '22 15:10

Sakshi Singh


I fixed this by adding a .swift file via xcode

  1. open XCode project
  2. create new file, select swift file
  3. confirm "Create Bridging Header"
  4. clean
  5. build

I tried a few combinations of these steps but found I needed all of them (ie. it must be done via xcode, you do need the bridging header, and you do need to clean the build folder).

like image 3
Daniel Loiterton Avatar answered Oct 09 '22 14:10

Daniel Loiterton